无法创建带有过剩的窗口

时间:2019-05-26 09:24:30

标签: python opengl glut

我正在尝试使用OpenGL库创建一个简单的窗口。

from OpenGL.GL import *
from OpenGL.GLUT import *
def draw():
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
    glLoadIdentity()
    glutSwapBuffers()


glutInit()
glutInitDisplayMode(GLUT_RGBA)
glutInitWindowSize(900,900)
glutInitWindowPosition(500,500)
window = glutCreateWindow("Paka Paka")
glutDisplayFunc(draw)
glutIdleFunc(draw)
glutMainLoop()

我将glut.dll和glut32.dll发送到同一文件夹。我运行程序,然后

Traceback (most recent call last):
  File "C:\Users\Osman\Desktop\kodlama v2\pygletdeneme.py", line 13, in <module>
    glutInit()
  File "C:\Users\Osman\AppData\Local\Programs\Python\Python37-32\lib\site-packages\OpenGL\GLUT\special.py", line 333, in glutInit
    _base_glutInit( ctypes.byref(count), holder )
  File "C:\Users\Osman\AppData\Local\Programs\Python\Python37-32\lib\site-packages\OpenGL\platform\baseplatform.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

我怎么了?

0 个答案:

没有答案