Attempt to call an undefined function glutInit
Question:
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:...OpenGLGLUTspecial.py", line 333, in glutInit
_base_glutInit( ctypes.byref(count), holder )
File "C:...OpenGLplatformbaseplatform.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)
Answers:
Problems:
- There was no problem with
pip install
or easy_install
- The
glut.dll
and glut32.dll
were 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.
I was being thrown the same error message. I tried installing the DLLs separately and everything and nothing worked.
The code that gave me the error was calling the glutInit() function. While I was getting the error, my imports looked like:
import OpenGL
import OpenGL.GL
import OpenGL.GLUT
import OpenGL.GLU
I then changed my imports to:
import OpenGL
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
and the error was fixed.
i cannot install the "dll" files, but works me fine install the PyOpenGL from "freeglut.sourceforge.net"
https://freeglut.sourceforge.net/index.php#download
There i download the last version and use the:
python -m pip install C:Usersdir-pathPyOpenGL-316-cp38-cp38-win_amd64.whl –force-reinstall
Warning: I had to change the name of the wheel file because the points "." has not permitted in the filename
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:...OpenGLGLUTspecial.py", line 333, in glutInit
_base_glutInit( ctypes.byref(count), holder )
File "C:...OpenGLplatformbaseplatform.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 install
oreasy_install
- The
glut.dll
andglut32.dll
were 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.
I was being thrown the same error message. I tried installing the DLLs separately and everything and nothing worked.
The code that gave me the error was calling the glutInit() function. While I was getting the error, my imports looked like:
import OpenGL
import OpenGL.GL
import OpenGL.GLUT
import OpenGL.GLU
I then changed my imports to:
import OpenGL
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
and the error was fixed.
i cannot install the "dll" files, but works me fine install the PyOpenGL from "freeglut.sourceforge.net"
https://freeglut.sourceforge.net/index.php#download
There i download the last version and use the:
python -m pip install C:Usersdir-pathPyOpenGL-316-cp38-cp38-win_amd64.whl –force-reinstall
Warning: I had to change the name of the wheel file because the points "." has not permitted in the filename