I follow the <OpenGL Programming Guide>, write a small test: #!/usr/bin/env python # encoding=utf-8
import sys from OpenGL.GL import * from OpenGL.GLUT import * def display(): glClear(GL_COLOR_BUFFER_BIT) glColor(1.0, 1.0, 1.0) glBegin(GL_POLYGON) glVertex(0.25, 0.25, 0.0) glVertex(0.75, 0.25, 0.0) glVertex(0.75, 0.75, 0.0) glVertex(0.25, 0.75, 0.0) glEnd() glFlush() def init(): glClearColor(0.0, 0.0, 0.0, 0.0) glMatrixMode(GL_PROJECTION) glLoadIdentity() glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0) def main(): glutInit(sys.argv) glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB) glutInitWindowSize(250, 250) glutInitWindowPosition(100, 100) glutCreateWindow('hello') init() glutDisplayFunc(display) glutMainLoop() if __name__ == '__main__': main() But I got an error: Traceback (most recent call last): File "test.py", line 36, in <module> main() File "test.py", line 26, in main glutInit(sys.argv) File "c:\python25\lib\site-packages\PyOpenGL-3.0.0b8-py2.5-win32.egg \OpenGL\GLUT\special.py", line 316, in glutInit _base_glutInit( ctypes.byref(count), holder ) File "c:\python25\lib\site-packages\PyOpenGL-3.0.0b8-py2.5-win32.egg \OpenGL\GLUT\special.py", line 57, in _base_glutInit return __glutInitWithExit(pargc, argv, _exitfunc) File "c:\python25\lib\site-packages\PyOpenGL-3.0.0b8-py2.5-win32.egg \OpenGL\platform\baseplatform.py", line 280, in __call__ self.__name__, self.__name__, OpenGL.error.NullFunctionError: Attempt to call an undefined function __glutInitWithExit, check for bool(__glutInitWithExit) before calling Can anyone please tell me why? -- http://mail.python.org/mailman/listinfo/python-list