Note: I wasn't 100% certain if this question belonged here or in Ask Ubuntu. I figured since it was about OpenGL programming I'd put it here, but if I should move it to Ask Ubuntu, please let me know.


I'm new to OpenGL and needed to figure out which version I could program in on my PC. A few Google/Stack Exchange searches shows that the usual solution is to run glxinfo | grep version and read the results, which I did and got the following:

server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
    Max core profile version: 4.5
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.0.5
OpenGL core profile shading language version string: 4.50
OpenGL version string: 3.0 Mesa 18.0.5
OpenGL shading language version string: 1.30
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 18.0.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

The confusing part is the following three lines:

OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.0.5
OpenGL version string: 3.0 Mesa 18.0.5
OpenGL shading language version string: 1.30

Everything I've read says to focus only on the Core Profile line, but I'm unable to draw anything unless I load functions and create a context under 3.0 or lower. Plus, when I call glGetString(GL_VERSION) I get 3.0 Mesa 18.0.5 printed to the terminal, but I'm not sure if that's because my hardware only supports 3.0 or if that's because I loaded functions for that level. Also, when I start writing shaders (I'm currently using Qt and an OpenGL Widget so haven't made a shader of my own yet) will I only be able to use GLSL 1.3 instead of 3.0+?

My Question

My big question is, what do the output strings actually mean? I can't find that answer. Which one tells me what my hardware can actually do? And, what do the other strings mean? Why am I getting a Core Profile of 4.5 when (as far as I can tell) I can't actually use 4.5? If my hardware can perform 4.5 operations, how do I make it do so?

  • 1
    $\begingroup$ It looks to me like you're using software emulation and if you want to use your GPU you need to install a different graphics driver. Installing new drivers really is a question for Ask Ubuntu though. $\endgroup$
    – Dan Hulme
    Jun 27 '19 at 9:03
  • $\begingroup$ How can you tell? Is it the simple fact that the version string and core profile version don't match? $\endgroup$ Jun 27 '19 at 16:46
  • $\begingroup$ No, it's because Mesa is an open-source OpenGL implementation. Usually you'd expect the GPU vendor's name to appear there. $\endgroup$
    – Dan Hulme
    Jun 27 '19 at 18:47
  • $\begingroup$ So, you're saying that Mesa is being my OpenGL driver instead of my Intel chip? I thought Mesa was a utility for getting OpenGL info from my hardware. $\endgroup$ Jun 27 '19 at 20:00
  • $\begingroup$ I've updated my drivers fully using Intel's update tool and, assuming this article is correct, I'm using the integrated drivers for my hardware. $\endgroup$ Jul 5 '19 at 21:29

When creating a OpenGL context you have to specify a profile mask, which is a way of telling the driver whether you want to use compatibility ("legacy") features or not.

Drivers are required to implement all core profile features, but compatibility profile is optional - creating a compatibility context can fail even if the driver supports the version you've requested.

The output from glxinfo you've pasted shows that you can create GL context with version up to 4.5 only when using core profile. If you want to use compatibility profile, the highest version you can request is 3.0.

One reason of the problem you are having is that you:

  • requested context version greater than 3.0, and
  • requested a compatibility profile (by setting GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB in GLX_CONTEXT_PROFILE_MASK_ARB).

If removing compatibility bit doesn't help, you'll need to double check if other context attributes are correct.

What I described above is documented in a more detailed way here.

  • $\begingroup$ OK. Let me reference this answer while poking around a bit with the Qt documentation and my program. I'm not creating the context myself, but am creating a Qt OpenGL Widget and trying to specify which level of functions I'd like loaded. Unfortunately I have no idea how Qt is actually creating the context behind the scenes and adhering it to the widget surface. $\endgroup$ Jul 5 '19 at 21:27
  • 1
    $\begingroup$ It seems that you have to set correct QSurfaceFormat (major and minor version numbers and profile to Core). By default, surface format is initialized for OpenGL 2.0, so you won't be able to use GL 4+ with Mesa drivers. $\endgroup$
    – joe_chip
    Jul 6 '19 at 13:33
  • $\begingroup$ Thank you! I sat down today to pick this project back up and that last comment helped me get everything up and running. I'm now rendering under the 4.5 core profile. :-) $\endgroup$ Jul 11 '19 at 22:17
  • $\begingroup$ I just realized we haven't talked specifically about the shading language version string. Given what's been said so far, can I assume they are read the same way? If I use a compatibility profile than the max shading language version I can use is 1.3, and if I use a core profile the max version is 4.5? $\endgroup$ Jul 11 '19 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.