我试图运行一个简单的OpenGL代码:
override func viewDidLoad() {
super.viewDidLoad()
tableView.dataSource = self
tableView.delegate = self
recipes = createRecipe()
getRecipes()
}
但每当我尝试执行它时,我都会收到此错误:
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
window = 0 # glut window number
width, height = 500, 400 # window size
def draw(): # ondraw is called all the time
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # clear the screen
glLoadIdentity() # reset position
# ToDo draw rectangle
glutSwapBuffers() # important for double buffering
# initialization
glutInit() # initialize glut
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH)
glutInitWindowSize(width, height) # set window size
glutInitWindowPosition(0, 0) # set window position
window = glutCreateWindow("noobtuts.com") # create window with title
glutDisplayFunc(draw) # set draw function callback
glutIdleFunc(draw) # draw all the time
glutMainLoop()
根据this question问题是,OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit,
check for bool(glutInit) before calling
和glut.dll
不属于glut32.dll
包。所以我下载了dll文件并将它们复制到PyOpenGL
并将该文件夹添加到C:/Windows/SysWOW64
,但错误仍然存在。在上面的相同问题参考中,一个用户还建议将dll文件复制到PATH
文件夹。
我在哪里可以在Ananconda安装中找到此文件夹?或者我应该在哪里复制dll文件以使其工作?感谢