Unsolved QOpenGLWidget: QSurfaceFormat sample count doesn't match *actual* sample count
-
I'm using an QOpenGLWidget to render some stuff in OpenGL 4.5 Core. Before displaying the window, I set the QSurfaceFormat. Depending on the number of samples (let's say 0 and 8), I get the desired behavior.
For 0 samples:
For 8 samples:Other integers also work as expected. But the strange thing is, that querying the current format in initializeGL() or paintGL() always yields the default surface format.
void MyWidget::paintGL() { auto fa = format(); std::cout << "Samples: " << fa.samples() << std::endl; [...] }
always prints "Samples: 0", no matter what number of samples is actually displayed in the widget.
However,GLint n; gl_func->glGetFramebufferParameteriv(GL_FRAMEBUFFER, GL_SAMPLES, &n); std::cout << "Samples: " << n << std::endl;
gives the correct number of samples.
I've also tried changing the default QSurfaceFormat before initializing anything, but the behavior is the same.
This behavior is not a problem for me per se, but I'd be interested in knowing what causes it and whether it can be avoided.OS: Windows 10 64-bit
GPU: GTX 1080 Ti
Using cmake + Visual Studio 2017 x64