Hi,

I'm currently walking down the oft-treaded path of creating Qt Widget overlays 
on top of an OSG scene. I've been doing a lot of reading and searching over the 
archives, and it seems like there are 2 main approaches. Eveything I can find 
on the topic is 3-5 years old, however, so I was wondering if I'd missed 
anything.

The first approach is to use osgQT::QWidgetImage to render the QWidgets to a 
texture and display that within the OSG scene. I've gotten that working, with a 
little bit of sub-classing to make a full-screen ortho projection work to 
create a HUD and to handle events properly. There is a bit of wonkiness to it 
though so I also want to try...

The second approach: to use a QGraphicsScene and to do the osg rendering in the 
drawBackground method. I'm currently trying to get this approach to work, but 
running into some issues. I've gathered, from the archives, that I need to save 
the openGL state at the beginning, then restore it once finished with the osg 
rendering, but I'm not sure exactly what the osg rendering consists of. I tried 
calling frame() on an osgviewer from there, but got a fistfull of openGL errors


> QGLContext::makeCurrent(): Failed.
> QGLShader: could not create shader 
> Vertex shader for simpleShaderProg (MainVertexShader & 
> PositionOnlyVertexShader) failed to compile
> QGLShader: could not create shader 
> Fragment shader for simpleShaderProg (MainFragmentShader & 
> ShockingPinkSrcFragmentShader) failed to compile
> QGLShaderProgram: could not create shader program 
> Errors linking simple shader: "" 
> QGLShader: could not create shader 
> Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & 
> UntransformedPositionVertexShader) failed to compile
> QGLShader: could not create shader 
> Fragment shader for blitShaderProg (MainFragmentShader & 
> ImageSrcFragmentShader) failed to compile
> QGLShaderProgram: could not create shader program 
> Errors linking blit shader: "" 
> QGLContext::makeCurrent(): Failed.


Maybe I am just setting things up wrong?

I have a QWidget that creates a QGraphicsView and an osgViewer::Viewer. I set 
the viewport of the GraphicsView to be the GLWidget from the Viewer's 
graphicsWindow.getGLWidget(). I subclassed the QGraphicsScene to give it a 
pointer to the viewer, and in the drawBackground method I saved off the openGL 
state, called frame() on the viewer, and restored the state, but the window 
doesn't render and gives me those errors. Has anyone had success with this? And 
if so, has anyone gotten it to work with anything other than a single-threaded 
approach?

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=60822#60822





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to