[Interest] Getting current OpenGL state with QtQuick

Preet prismatic.project at gmail.com
Sat Mar 8 07:04:10 CET 2014


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



More information about the Interest mailing list