2023/9/4

windows10 : pyopengl , glutInit( ) error : OpenGL.error.NullFunctionError

ref: windows7 下run 的好好的,升級到windows10 之後就fail 了,
用 example code 來測試:
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *

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

glutInit()
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA)
glutInitWindowSize(300,300)
glutCreateWindow(b"teapot")
glutDisplayFunc(Draw)
glutIdleFunc(Draw)
glutMainLoop()

if __name__ == '__main__':
        Draw()
出現 Error:
Traceback (most recent call last):
  File "D:\teapot.py", line 11, in &;t;module>
    glutInit()
  File "D:\Python311\Lib\site-packages\OpenGL\GLUT\special.py", line 333, in glutInit
    _base_glutInit( ctypes.byref(count), holder )
  File "D:\Python311\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  
結果google 說是 pypl official 的 opengl package 沒有包到兩個 dlll...

沒有留言:

張貼留言