0

I have decided I would like to start learning OpenGL through Python. I have downloaded PyOpenGL via pip, and attempted to run a program found online to test PyOpenGL and begin to learn how it works. A link to the code I have used is here. My issue is I keep getting this error

OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling.

I attempted the solution to this problem found here. And I tried downloading the extension file from here .

However in my Command Prompt I keep receiving this error

ERROR: PyOpenGL-3.1.3b2-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform. 

What am I doing wrong? Thanks

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Kasim B
  • 41
  • 5
  • it may need C/C++ libraries for OpenGL. SO you may have to find `glut` and install it. But it is not python's module. See [FreeGlut](http://freeglut.sourceforge.net/) – furas Aug 05 '19 at 17:50
  • 1
    That error about your wheel suggests that you've got the wrong version. The filename suggests that one is for 64-bit Python 3.7 on Windows. If you're on a different OS or Python version, you'll need to get a wheel that matches what you actually have (or upgrade your interpreter, I suppose). – Blckknght Aug 05 '19 at 18:04
  • 1
    Do you use Python 2.7? *`PyOpenGL-3.1.3b2-cp37-cp37m-win_amd64.whl`* is for Python 3.7 on windows 64bit – Rabbid76 Aug 05 '19 at 18:14
  • 1
    Ah, it seems I was using the wrong version. I downloaded the file titled PyOpenGL-3.1.3b2-cp37-cp37m-win32 and it worked perfectly. The error has now gone. Guess that teaches me to be more careful about reading the specific version names of files. Thank you – Kasim B Aug 05 '19 at 18:33
  • @Rabbid76 problem is resolved so only for information: I tried to find `glutInit` in source code and it looks like `glutInit = platform.createBaseFunction(...)` so maybe it had problem to create this function when `glut/freeglut` wasn't installed. In [documentation](http://pyopengl.sourceforge.net/documentation/installation.html) I found that Window installs `glut` with `PyOpenGL` (so it removes this problem) but on other systems glut has to be installed manually. – furas Aug 05 '19 at 18:43
  • @furas. Actually I think that may have also been a problem in this case. Apparently the download for PyOpenGL via "pip install PyOpenGL" for some reason did not download glut which is why the download had to be completed via .whl file. Or at least that is what I read from the first solution link I tried. – Kasim B Aug 05 '19 at 18:52

0 Answers0