问题描述
- Python3.5.1 PyopenGL模块调用出错
-
测试PyopenGL模块的源代码来自网上:from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * def drawFunc(): glClear(GL_COLOR_BUFFER_BIT) #glRotatef(1, 0, 1, 0) glutWireTeapot(0.5) glFlush() glutInit() glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA) glutInitWindowSize(400, 400) glutCreateWindow("First") glutDisplayFunc(drawFunc) #glutIdleFunc(drawFunc) glutMainLoop()
运行错误提示如下:
============= RESTART: F:Python35-32CodePyOpenGLCodeTest.py ============= Traceback (most recent call last): File "F:Python35-32CodePyOpenGLCodeTest.py", line 11, in <module> glutInit() File "F:Python35-32libsite-packagesOpenGLGLUTspecial.py", line 333, in glutInit _base_glutInit( ctypes.byref(count), holder ) File "F:Python35-32libsite-packagesOpenGLplatformbaseplatform.py", line 407, in __call__ self.__name__, self.__name__, OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling >>>
解决方案
你是否没有调用初始化 看看错误提示
解决方案二:
已解决,请看我的博客http://blog.csdn.net/u013166622/article/details/50831467
时间: 2024-11-22 21:40:21