Skip to content
Advertisement

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

I’m following this very easy guide in order to make my first steps into PyOpenGL.

  1. I installed pip install PyOpenGL PyOpenGL_accelerate , all good.

  2. I tested the installation through the test code:

    import OpenGL.GL import OpenGL.GLUT import OpenGL.GLU print(“Imports successful!”) # If you see this printed to the console then installation was successful

all good

I now run this script:

JavaScript

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

So i read a few guides online and they point to download the wheel from here. So I go ahead and I download PyOpenGL_accelerate‑3.1.5‑cp38‑cp38‑win_amd64.whl and PyOpenGL‑3.1.5‑cp38‑cp38‑win_amd64.whl because I’m running Python 3.8

  1. pip install .PyOpenGL_accelerate-3.1.5-cp39-cp39-win_amd64.whl returns PyOpenGL-accelerate is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
  2. pip install .PyOpenGL_accelerate-3.1.5-cp38-cp38-win_amd64.whl returns PyOpenGL-accelerate is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.

How can a so simple guide lead me to a so painful result?

How can I check if Visual C++ 14.0 build tools is installed. Maybe that is the only step I’m missing?

Advertisement

Answer

The freeglut DLL is missing from the package.

Unistall “PyOpenGL”:

JavaScript

Download the package wheel (e.g.: “PyOpenGL‑3.1.6‑cp311‑cp311‑win_amd64.whl”) from, Unofficial Windows Binaries for Python Extension Packages and install it:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement