QGLFormat has no effect
-
Hello,
I have a QWidget that displays some OpenGl content. That works fine.
Now I am experimenting with other settings (e.g. stereo), but noticed that I cannot even change the basic settings inside of QGLFormat.In my QWidget constructor, this is what I do:
@CMyGLWidget::CMyGLWidget(QWidget *parent)
{
QGLFormat fmt;
fmt.setStereo(false);
fmt.setDoubleBuffer(false);
fmt.setDepth(false);
fmt.setStencil(false);
fmt.setDirectRendering(false);
::QGLWidget(fmt,parent);
if (format().depth())
printf("Has depth!!\n");
if (format().doubleBuffer())
printf("Has double buffer!!\n");
if (format().stereo())
printf("Has stereo!!\n");
if (format().stencil())
printf("Has stencil!!\n");
if (format().directRendering())
printf("Direct rendering!!\n");
}@But whatever settings I select for the format, I always end-up with:
- non-stereo (ok, that's very much hardware-related)
- double buffer
- depth
- stencil
- direct rendering
What does that mean? That my code is not correct, or that my graphic card (or platform) is not flexible? One would think that disabling the depth buffer should always work.
I am running Windows 8.1, Qt 5.1.1, and the graphic card is a NVidia GeForce GT 620
Thanks for any help/comment
-
Thanks for your reply. You are perfectly right. Actually I first did it the correct way (see below), but seeing no effect I tested some other constructs. Following does not work either:
@CMyGLWidget::CMyGLWidget(QWidget *parent) : QGLWidget(QGLFormat(QGL::SingleBuffer|QGL::NoDepthBuffer|QGL::NoStencilBuffer|QGL::IndirectRendering),parent)
{
if (format().depth())
printf("Has depth!!\n");
if (format().doubleBuffer())
printf("Has double buffer!!\n");
if (format().stereo())
printf("Has stereo!!\n");
if (format().stencil())
printf("Has stencil!!\n");
if (format().directRendering())
printf("Direct rendering!!\n");
}
@Same result as in my first post. How come?