-
Bug
-
Resolution: Cannot Reproduce
-
P1: Critical
-
5.4.2
-
None
-
Linux Arch Kernel: 4.0.5-1-ARCH
Nvidia driver version: 352.21, Nvidia GT420M as well as Quadro K5000
use case
I am creating an OpenGL context of the most recent by Qt supported version. (currently 4.3, core profile)
Classes using OpenGL functions receives a reference to the QOpenGLContext. Also they store a QOpenGLFunctions pointer using the version necessary for the class.
auto glFuncs = context->versionFunctions<QOpenGLFunctions_3_3_Core>()
Using this 3.3 core glFuncs pointer in an 3.4 core context leads to memory access violations.
work around 1, showing another bug
I thought than that the major version difference between the core profile context and the version functions is not supported, due to maybe even further deprecated functions. So i tried the following:
setup
- setup the context as an 4.3 compatibility profile.
- using functions with: auto glFuncs = context->versionFunctions<QOpenGLFunctions_3_3_Compatibility>()
behavior:
When the compatiblity flag is used to setup the QOpenGLContext, than the most recent driver supported context version is returned (4.5, compatibility). So the version specified with setMajorVersion and setMinorVersion are completely ignored. That leads to the situation of handling a more recent version than the current stable Qt lib release is able to handle. So the call to context->initializeOpenGLFunctions crashes with an memory access violation.
Small reproducer for the initialize crash can be found here:
https://github.com/cguentherTUChemnitz/QOpenGLContextCompatibilityCrash
Backtrace is added to the comments.
workaround 2, restricts the usage
So currently i have to create the 4.3 core profile context and have to use for all version functions also the 4.3. core profile.
auto glFuncs = context->versionFunctions<QOpenGLFunctions_4_3_Core>()
This way is very odd, because i have to use all the new 4.3 functions in classes even if they use only 3.3 functionality. It would be nice to see at the requested version function, which OpenGL version is actually necessary for that specific class. This is not a desirable situation, because it unnecessarily restricts the usage of OpenGL 3.3. hardware.
So please correct me, if i misunderstood the usage of requesting different version functions than the context is created for.