OpenGL on Mac OSX Mojave 10.14


On my latest MacOS Mojave (10.14) laptop, using Python3.6 I’m trying to use OpenGL (using pyOpenGL), and I’m getting an error when trying to use some of the functions. e.g.

from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *

glGenVertexArrays throws the following exception:

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

Under the hood, inside that function, there’s a function called “” that receives “false” for trying to check the OpenGL extension: ‘GL_ARB_vertex_array_object’

This code works perfectly on a windows machine.

some OpenGL functionality exists (some OpenGL functions are called before and don’t raise errors). Anyone knows of a workaround? Maybe something to install\upgrade\downgrade?

I’m aware that Apple announced that they will drop support for OpenGL in the future, but from I could find, it’s not supposed to affect 10.14 yet.



glutInitContextVersion(3, 2)

If that doesn’t work, you’re probably out of luck. MacOS doesn’t support the OpenGL 3.2+ compatibility profile. You have to choose between OpenGL 2.1 or 3.2+ core profile. GLUT doesn’t use the core profile unless specifically requested, because that will break code written for earlier versions of OpenGL. VAOs were added in 3.0, so using the default 2.1 context won’t work.

Note that glutInitContextVersion() and glutInitContextProfile() aren’t present in the original GLUT library; they were added by FreeGLUT.

Windows and Linux support the use of the compatibility profile, so the default context on those platforms is a compatibility-profile context for the highest supported OpenGL version.