I am trying to use PyOpenGL and am running into some errors getting even the
most basic program working. For example, this program:
---------------------------------------------
from OpenGL.GL import *
from OpenGL.GLUT import *
def init():
glClearColor(0, 0, 0, 0)
def display():
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glutInit('')
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
-------------------------------------------
generates this error:
-------------------------------------------
Traceback (most recent call last):
File "C:/Python25/Py3D/test2.py", line 12, in <module>
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
File "C:\Python25\Lib\site-packages\OpenGL\platform\baseplatform.py", line
258, in __call__
self.__name__, self.__name__,
NullFunctionError: Attempt to call an undefined function
glutInitDisplayMode, check for bool(glutInitDisplayMode) before calling
---------------------------------------------
which seems to be referring to this code in
"Python25\Lib\site-packages\OpenGL\platform\baseplatform.py":
---------------------------------------------
def __call__( self, *args, **named ):
if self.extension and self.load():
return self( *args, **named )
else:
from OpenGL import error
raise error.NullFunctionError(
"""Attempt to call an undefined function %s, check for
bool(%s) before calling"""%(
self.__name__, self.__name__,
)
)
-----------------------------------------------
Which appears to tell me that GLUT is not properly installed, which is silly
because GLUT works when I use Microsoft Visual C++ (but who chooses to use
Microsoft Visual C++ when they can use python?). What do I need to do to get
GLUT up on python?
|