我正在python中尝试Opengl并且Iam收到此错误

时间:2020-09-01 14:44:07

标签: python opengl glfw

第一个Python OpenGL程序 ogl1.py

from OpenGL.GLUT import *
from OpenGL.GL import *
from OpenGL.GLU import *

def draw():
  glClear(GL_COLOR_BUFFER_BIT)
  glutWireTeapot(0.5)
  glFlush()

glutInit(sys.argv)
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
glutInitWindowSize(250, 250)
glutInitWindowPosition(100, 100)
glutCreateWindow("My Second OGL Program")
glutDisplayFunc(draw)
glutMainLoop()

错误

Traceback (most recent call last):
 File "C:\Users\Jahnavi Yeadoti\AppData\Local\Programs\Python\Python38\pythonprojact\teapot.py", line 15, in <module>
   glutInit(sys.argv)
 File "C:\Users\Jahnavi Yeadoti\AppData\Local\Programs\Python\Python38\lib\site-packages\OpenGL\GLUT\special.py", line 333, in glutInit
   _base_glutInit( ctypes.byref(count), holder )
 File "C:\Users\Jahnavi Yeadoti\AppData\Local\Programs\Python\Python38\lib\site-packages\OpenGL\platform\baseplatform.py", line 423, in __call__
   raise error.NullFunctionError(
OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling

0 个答案:

没有答案
相关问题