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?

cdn
  • 654
  • 1
  • 8
  • 16

2 Answers2

2

place the glut32.dll next to the py file.

Check this link

Community
  • 1
  • 1
Szabolcs Dombi
  • 5,493
  • 3
  • 39
  • 71
  • I'm still getting the same error, even with the dll in the same directory as the program – cdn Oct 06 '16 at 20:24
  • 1
    do you have 64 bit python and 64 bit dll? – Szabolcs Dombi Oct 07 '16 at 12:46
  • This doesn't work for me. I'm using 64 bit Python, but I guess that `freeglutd.dll` (which is the name of the file that I'm getting) is 32 bit, since CMAKE generated the value `C:/Program Files (x86)/freeglut` for the variable `CMAKE_INSTALL_PREFIX`. Can I somehow use this dll in spite of it being 32 bit, or make CMAKE generate a 64-bit dll instead? – HelloGoodbye Jun 28 '21 at 00:00
1

I fixed this by switching to the 32 bit freeglut.dll file. I thought that the 32bit vs 64bit was dependent on your operating system but it's actually dependent on which kind of Python you have, as I have 32 bit Python I need the 32 bit dll.

cdn
  • 654
  • 1
  • 8
  • 16