Search code examples
pythonfreeglutpyopengl

Setting up PyOpenGL with freeglut for Python 3.5.2


I am trying to set up my machine to use PyOpenGL with freeglut. I have Python version 3.5.2 and a 64 bit copy of Windows 8.

I have downloaded PyOpenGL using pip, then downloaded freeglut and placed the include\ and lib\ folders at C:\Program Files\Common Files\MSVC\freeglut. I have also placed a link to the 64 bit freeglut.dll file in the environment variables linking to C:\Work\freeglut.dll

As I do not know any OpenGL yet I am simply trying to run the code from this page to see if my setup is functional http://www.de-brauwer.be/wiki/wikka.php?wakka=PyOpenGLSierpinski. When run I receive the error message

Traceback (most recent call last):
  File "sier_tri.py", line 35, in <module>
    glutInit()
  File "C:\Users\Dylan\AppData\Local\Programs\Python\Python35-32\lib\site-packag
es\OpenGL\GLUT\special.py", line 333, in glutInit
    _base_glutInit( ctypes.byref(count), holder )
  File "C:\Users\Dylan\AppData\Local\Programs\Python\Python35-32\lib\site-packag
es\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

Does anyone know what is causing this/how to fix it?


Solution

  • place the glut32.dll next to the py file.

    Check this link