I need a glut window in python. I have the following exception using Python 3.5 and PyOpenGL.GLUT
Traceback (most recent call last):
File "D:\...\Test.py", line 47, in <module>
if __name__ == '__main__': main()
File "D:\...\Test.py", line 9, in main
glutInit(sys.argv)
File "C:\...\OpenGL\GLUT\special.py", line 333, in glutInit
_base_glutInit( ctypes.byref(count), holder )
File "C:\...\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
Platform: Windows
Why do i get this error?
Here is my code:
from OpenGL.GLUT import *
import sys
glutInit(sys.argv)
Problems:
- There was no problem with
pip installoreasy_install - The
glut.dllandglut32.dllwere missing. (They are not part of the PyPI package) you have to install them separately or download it like I did.
Unzipped the dll files from the glutdlls.zip and placed them next to my python file.
Note: You can add the dll files to your PATH variable. Not necessary to keep them next to the py file.
来源:https://stackoverflow.com/questions/39181192/attempt-to-call-an-undefined-function-glutinit