0

I am trying to develop C/C++ applications using OpenGL. Unfortunately, I have been unable to access any functionality past OpenGL 3.0. I have Mesa version 18.0.5, Linux Mint 18 64-bit, the 4.18.1 Kernel, and Intel Integrated Graphics.

Terminal output:

 ~ $ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Broadwell-U 
Integrated Graphics (rev 09)
 ~ $ glxinfo | grep OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 5500 (Broadwell 
GT2) 
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.0.5
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 18.0.5
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 18.0.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 
3.10
OpenGL ES profile extensions:

I am certain that my hardware supports up to OpenGL 4.4, as this machine was previously a Windows 10 machine before MS pushed/forced a broken update, and I developed using OpenGL 4.4 and GLSL 440 during that time.

Additionally, I can run OpenGL 4.4 programs on Java through JOGL, which has all the required OpenGL libraries packaged together and doesn't seem to rely on the system version at all.

So basically, why does Mesa say that the core version is 4.5, but then gives the version string of 3.0? (The same version glGetString(GL_VERSION) returns.) And how can I regain access to OpenGL 4.4? (If not 4.5!)

  • 1
    What does glxinfo | grep "Max core" output? You should be able to set MESA_GL_VERSION_OVERRIDE to any supported version up to the maximum listed there. – Stephen Kitt Aug 21 '18 at 16:52
  • @Stephen Kitt It outputs Max core profile version: 4.5. I saw MESA_GL_VERSION_OVERRIDE being used to run individual applications with the override. Does this mean I need to use this every single time? Is there a way to set that as the default? – T. K. Aug 21 '18 at 17:39
0

As I understand it, the important value is the “max core profile version”, not the “OpenGL version string”. If you don’t specify a core profile when creating your context, or if you write something like

glfwOpenWindowHint(GLFW_OPENGL_PROFILE, 0);

Mesa will give you an OpenGL 3.0 context (this sort of makes sense since profiles were introduced in OpenGL 3.0, so that’s the last version where applications can be expected not to know about them). If you want a newer version of OpenGL, you need to specify the corresponding profile:

glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

or

glutInitContextProfile(GLUT_CORE_PROFILE);

along with the version using glutInitContext().

Note that imposing an OpenGL version in this manner creates a strong constraint; I imagine you know what you’re doing though ;-). Some developers try to target as low a version as reasonable (OpenGL 3.2 for example) and then ask for whatever extensions they need — that often works better, since popular extensions tend to be available for a while before the corresponding OpenGL version is fully supported by the drivers.

MESA_GL_VERSION_OVERRIDE is only a debugging or Mesa development tool; it forcibly overrides the reported OpenGL version, and can be set to values which Mesa doesn’t actually support!

  • Using glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); causes glfwCreateWindow(640, 480, "Hello World", NULL, NULL); to return null. (As does setting the compatibility profile) glfwOpenWindowHint() is correct for glfw(2) but replaced by glfwWindowHint() in glfw3. I am currently using MESA_GL_VERSION_OVERRIDE as a launch option in my IDE and it works perfectly, allowing me to use the functionality I need. The only problem with it is, as you point out, that's not really what it's for. Many thanks for the help. I think I will keep trying to get the window hints to work. – T. K. Aug 22 '18 at 14:04
  • I still haven't been able to get glfwWindowHint() to work on my system, but it really does seem to be the "Correct" answer. I guess I'll stick with the hack for now. Thanks for the help. – T. K. Aug 23 '18 at 15:26

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.