Hi,

I think I have understood the osgviewerQT sample. This creates a
QGLWidget overloads its paintGL() function and calls into
osgviewer::frame() to let OSG do the rendering and all is good - i.e.
we see the OSG scene displayed inside a window managed by QT.

I am now trying to do something more advanced and let QT render
semi-transparent widgets on top of the openGL scene. In the relevant
QT examples this is done by assigning a QGraphicsScene to the
QGLWidget instead of overloading the QGLWidget's paintGL() function.
The relevant QT examples are called "boxes" (in the demos folder of
QT) as well as "openglcanvas" sample ( see the article
http://doc.trolltech.com/qq/qq26-openglcanvas.html )

The QGraphicsScene has a drawBackground() function where we are inside
an openGL context created and maintained by QT.   Trolltech (Nokia)
say that you can do your own OpenGL 3D rendering here, but you're
supposed to revert all changes you make to the OpenGL state when
you're done rendering, so that QT can draw its widgets on top
successfully (also using OpenGL, mind you).

Apparently simply calling osgviewer::frame() here is doomed to failure
as the openGL states of OSG and those maintained of QT will clash
seriously.

Unfortunately my experience with OSG's state management is poor. How
would I achieve to save all OpenGL state, then make OSG set up its
needed OpenGL state from scratch, render its frame, and then restore
QT's previous OpenGL state?

Would it be easier to let OSG render everything to texture using a
separate OpenGL context and just render this texture inside
drawBackground()?

Any help with this will be greatly appreciated.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to