Home > database >  Linux - default OpenGL version
Linux - default OpenGL version

Time:12-05

I work on Ubuntu 18.04. I don't define GL_GLEXT_PROTOTYPES. I load "core" OpenGL functions using glXGetProcAddress. My application links to /usr/lib/x86_64-linux-gnu/libGL.so. Some legacy OpenGL functions are available without defining GL_GLEXT_PROTOTYPES or calling glXGetProcAddress, for example glColor3f. Which OpenGL version (functions) is available by default under Linux ?

Edit

I assume that the hardware supports the newest OpenGL version. Moreover I use compatibility profile and OpenGL headers (gl.h, glext.h) from the standard Ubuntu location: /usr/include/GL. It looks like that those headers have been installed by mesa-common-dev apt package.

CodePudding user response:

Traditionally, the libGL.so on Linux is provided by the vendor of your graphics driver. There is no real "default" version. The closes thing to a standard you can find in that regard is the OpenGL® Application Binary Interface for Linux which states:

3.4. The libraries must export all OpenGL 1.2, GLU 1.3, GLX 1.3, and ARB_multitexture entry points statically.

and

4.5. All OpenGL 1.2 and ARB_multitexture, GLU 1.3, and GLX 1.3 entry points and enumerants must be present in the corresponding header files gl.h, glu.h, and glx.h, even if only OpenGL 1.1 is implemented at runtime by the associated runtime libraries.

So that is basically the set of directly exported GL functions you can rely on. Typically, the GL libs of various vendors export much more, but the official way yo query things is the extension mechanism.

Note that on Linux, the modern way to use OpenGL is by the vendor-neutral GL dispatch library which provides libOpenGL.so instead of libGL.so. It seems to export all core OpenGL functions known at the time it was built. But that doesn't mean that the particular vendor implementation will support all these functions.

  • Related