Linux – How do I create an OpenGL 3 context using Qt 4?

How do I create an OpenGL 3 context using Qt 4?… here is a solution to the problem.

How do I create an OpenGL 3 context using Qt 4?

I want to learn graphics programming using OpenGL. Since I will just start learning it, I decided to learn the new /OpenGL3 way of doing things. As far as I can tell, an OpenGL 3 context must be created for this (if I understand correctly, the core configuration file in the new OpenGL 3.2).Well, I considered using Qt for this, currently using version 4.5.2 because I already know it and love it, and it supports creating OpenGL widgets. The problem I’m having is that it looks like OpenGL widgets are always boxed with the old OpenGL 2 context and I don’t see the option to join/switch it to OpenGL 3 way. Am I missing something obvious here or do I need something trickier to create an OpenGL 3 context using Qt? Does the current version of Qt even support it? I’m using Linux, if it’s any different.

Solution

Mesa software rendering is still stuck on OpenGL 2.1. If you are using binary NVidia drivers, they provide OpenGL 3.2 support on sufficiently new hardware. AMD’s The latest FGLRX supports 3.1. Open source drivers seem to peak around 1.3-1.4.

If you’ve come this far, you may have to crack the Qt source code to use the GLX_ARB_create_context instead of GLXCreateContext to get the OpenGL 3.2 Core context.

This guy seems to have been partially successful, if you haven’t passed it yet Google found the words on the topic.

Related Problems and Solutions