如何在 Windows 上的 Anaconda 上安装 GLUT?
How to install GLUT on Anaconda on Windows?
我正在尝试 运行 一个简单的 OpenGL 代码:
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()
但每次我尝试执行它时都会收到此错误:
OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit,
check for bool(glutInit) before calling
根据 问题是 glut.dll
和 glut32.dll
不是 PyOpenGL
包的一部分。所以我下载了 dll 文件并将它们复制到 C:/Windows/SysWOW64
并将该文件夹添加到 PATH
,但错误仍然存在。在上面的同一个问题参考中,一位用户还建议将 dll 文件复制到 Python OpenGL DLL
文件夹。
在我的 Ananconda 安装中哪里可以找到这个文件夹?或者我应该在哪里复制 dll 文件才能使其正常工作?谢谢
我正在尝试 运行 一个简单的 OpenGL 代码:
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()
但每次我尝试执行它时都会收到此错误:
OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit,
check for bool(glutInit) before calling
根据 glut.dll
和 glut32.dll
不是 PyOpenGL
包的一部分。所以我下载了 dll 文件并将它们复制到 C:/Windows/SysWOW64
并将该文件夹添加到 PATH
,但错误仍然存在。在上面的同一个问题参考中,一位用户还建议将 dll 文件复制到 Python OpenGL DLL
文件夹。
在我的 Ananconda 安装中哪里可以找到这个文件夹?或者我应该在哪里复制 dll 文件才能使其正常工作?谢谢