QT supports OpenGL 5.0, 6.0 and 10.0
The following code works very well:
glFormat.setVersion( 5, 0 );
cout << glFormat.majorVersion() << "," << glFormat.minorVersion() << endl;
It retrieves a perfect "5,0". Actually, I get the same result when requiring OpenGL 10.
Analysis : When requiring the compatibility profile, you are not bounded.
When requiring a GLFormat::CoreProfile, I meet the 3,1 upper bound.
So my question: How can I retrieve the really supported OpenGl level in Compatibility Profile.
Is this a bug ?
this function returns the OpenGL version which Qt has been configured with that. You may try other versions of OpenGL and configure Qt yourself.
In between, I've seen that the format must be requested after the creation of the OpenGL context.
It sounds that before the actual creation of the context, you might wish whatever version you want
Just like Christmas : You might wish a very big present and sometimes get a smaller one. But you know it after it appends, not before
it's about setVersion:
[quote author="http://developer.qt.nokia.com/doc/qt-4.8/QGLFormat.html" date="0"]
Set the OpenGL version to the major and minor numbers. If a context compatible with the requested OpenGL version cannot be created, a context compatible with version 1.x is created instead.