How to create an OpenGL 3 context with Qt 4?

I would like to learn graphical programming using OpenGL. And since I'm just starting to learn it, I decided to learn a new / OpenGL 3 way of doing things. As far as I can see, for this you need to create an OpenGL 3 context (Core profile in the new OpenGL 3.2, if I understand it correctly). Well, I thought about using Qt for this, I am currently using version 4.5.2, since I already know and love this, and it supports the creation of an OpenGL widget. My problem is that it seems that the OpenGL widget always stacks with the old OpenGL 2 context, and I don’t see the possibility to enable it / switch to OpenGL 3. I missed some obvious thing here or I need something more complex, to create an OpenGL 3 context with Qt? Is it even supported in the current version of Qt? I use Linux if that matters.

+3
source share
1 answer

Mesa's software rendering still remains on OpenGL 2.1. If you use NVidia binary drivers, they provide OpenGL 3.2 support on fairly recent hardware. AMD latest version of fglrx supports 3.1. Open source drivers seem to exceed 1.3-1.4.

If you get to this, you may have to hack into Qt sources to use GLX_ARB_create_context instead of GLXCreateContext to get Core OpenGL 3.2 context.

This guy seems to have had partial success if you haven't met the stream through Google.

+4
source

Source: https://habr.com/ru/post/1716739/


All Articles