Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Possible to enable depth buffer for openGL painter?



  • I would like to be able to draw UI components at the beginning of a QOpenGLWidget scene and have it affect the depth buffer so fragment shader operations can be rejected under the UI components. I went through a bit of the source and if I'm getting it right the openGL paint engine disables the depth buffer but does use the stencil buffer. As is it appears it is meant to draw on top of what is already there.

    The only idea I have so far is if the stencil buffer is still intact after the 2d painting I could extract it and set the depth buffer as appropriate.



  • I think the easiest way to do what I want is render it into an FBO texture and draw it on a quad. If i'm using opaque rectangles I could draw a blank quad before the 3d scene and let the 2d painter fill it in at the very end as well.


Log in to reply