Re: [osg-users] Using osgText with GraphicsWindowEmbedded and Qt causes problems

2012-07-09 Thread Robert Osfield
HI Preet,

You'll need to rest OpenGL into consistent state when moving between
Qt and the OSG.  I don't know anything about QGLFrameBufferObject so
can't comment on what state it'll be managing.

What I can say is that the OSG has it's own native FBO support that
will work just fine all by itself and normally there wouldn't be any
need to get QT involved.  Personally I'd try to keep Qt out for doing
too much OpenGL work itself.

Robert.

On 5 July 2012 01:30, Preet prismatic.proj...@gmail.com wrote:
 Hi.

 I have a scene consisting of just an osgText object and its shaders.
 The scene works fine in a default application where OpenSceneGraph is
 the only library being used, but won't render correctly when I try to
 draw to a QGLFrameBufferObject. Drawing to the FBO works fine if I
 don't use osgText (other than text, I've just tried simple models so
 far).

 Using osgText 'messes' the Qt UI up, by changing the order of what (Qt
 items) are painted or changing their size or stretching them...
 nothing from OSG seems to be painted at all.

 I'm guessing there's a conflict with OpenGL calls between Qt and OSG.
 OSG is set up using GraphicsWindowEmbedded, and in Qt, I bind my
 framebuffer before calling osgViewer's frame(), and release it after.
 I'm lost as to why using osgText of all things would cause this issue.
 Just the inclusion of osgText in my scene tree causes the problem.
 Does anyone have any suggestions as to how I can force Qt and OSG to
 play nice?


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


Re: [osg-users] Using osgText with GraphicsWindowEmbedded and Qt causes problems

2012-07-09 Thread Preet
Hi Robert,

On Mon, Jul 9, 2012 at 9:01 AM, Robert Osfield robert.osfi...@gmail.com wrote:
 HI Preet,

 You'll need to rest OpenGL into consistent state when moving between
 Qt and the OSG.  I don't know anything about QGLFrameBufferObject so
 can't comment on what state it'll be managing.

This was indeed the case. For anyone else that runs into issues
integrating the two libs, I've found some OpenGL states that should be
reset after drawing an OSG frame, before control is given back to Qt.
More state settings might need to be changed depending on what exactly
OpenSceneGraph is being used for, but the following seems to work with
some basic textured geometry.

// qpainter uses vertex attribs 3,4,5 so we need to explicitly disable them:
glDisableVertexAttribArray(3);
glDisableVertexAttribArray(4);
glDisableVertexAttribArray(5);

// qpainter requires depth testing to be off
glDisable(GL_DEPTH_TEST)

// not sure if this is required; osg changes this when using textures
so I reset it to default
glPixelStorei(GL_UNPACK_ALIGNMENT,4);


 What I can say is that the OSG has it's own native FBO support that
 will work just fine all by itself and normally there wouldn't be any
 need to get QT involved.  Personally I'd try to keep Qt out for doing
 too much OpenGL work itself.

 Robert.

 On 5 July 2012 01:30, Preet prismatic.proj...@gmail.com wrote:
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Using osgText with GraphicsWindowEmbedded and Qt causes problems

2012-07-04 Thread Preet
Hi.

I have a scene consisting of just an osgText object and its shaders.
The scene works fine in a default application where OpenSceneGraph is
the only library being used, but won't render correctly when I try to
draw to a QGLFrameBufferObject. Drawing to the FBO works fine if I
don't use osgText (other than text, I've just tried simple models so
far).

Using osgText 'messes' the Qt UI up, by changing the order of what (Qt
items) are painted or changing their size or stretching them...
nothing from OSG seems to be painted at all.

I'm guessing there's a conflict with OpenGL calls between Qt and OSG.
OSG is set up using GraphicsWindowEmbedded, and in Qt, I bind my
framebuffer before calling osgViewer's frame(), and release it after.
I'm lost as to why using osgText of all things would cause this issue.
Just the inclusion of osgText in my scene tree causes the problem.
Does anyone have any suggestions as to how I can force Qt and OSG to
play nice?


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