[Interest] Getting current OpenGL state with QtQuick

Gunnar Sletta gunnar.sletta at jolla.com
Sat Mar 8 11:03:53 CET 2014


Assuming that you do your FBO rendering in QQuickWindow::beforeRendering(), you should call QQuickWindow::resetOpenGLState() when you are done. That will put the GL in good shape for scene graph rendering to begin.

The scene graph renderer does track some states internally, but this is not available externally and most of those states are reset by the time the renderer completes anyway.

cheers,
Gunnar

On 08 Mar 2014, at 07:04, Preet <prismatic.project at gmail.com> wrote:

> Hi,
> 
> I'm doing some manual OpenGL rendering with a custom QQuickItem (more
> or less rendering to FBO as outlined in the docs). I want to make sure
> I restore OpenGL state to how it was when Qt hands it off after my
> QQuickItem does its custom rendering. However, calling on OpenGL for
> all a bunch of state information every frame seems like a bad idea.
> For example, if I wanted to check if GL_DEPTH_TEST was enabled, I
> could do:
> 
> GLboolean depthTestEnabled;
> glGetBooleanv(GL_DEPTH_TEST,&depthTestEnabled);
> 
> But apparently calling glGet_ operations can be pretty slow (GPU has
> to stop what its doing and respond synchronously to the CPU). Checking
> ~a dozen things like this every frame is something I want to avoid if
> I can.
> 
> Is there some way to get access to the status of some of the OpenGL
> state attributes through QtQuick itself? Does the QtQuick SG track
> such state internally and make it accessible?
> 
> 
> Regards,
> 
> Preet
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list