HI

 

You can do this with your current code straight forwardly or you could use
osgHud which provides a way to do this at the OSG level and this get the
advantage of an integrated solution

 

See OpenSceneGraph\examples\osghud

 

____________________________________________________________________________
__

Gordon Tomlinson 

 <mailto:gor...@gordontomlinson.com> gor...@gordontomlinson.com
IM:  <mailto:gordon3db...@3dscenegraph.com> gordon3db...@3dscenegraph.com
 <http://www.vis-sim.com/> www.vis-sim.com
<http://www.gordontomlinson.com/> www.gordontomlinson.com 

____________________________________________________________________________
__

 

From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Gianluca
Natale
Sent: Monday, March 23, 2009 6:49 AM
To: Osg Users
Subject: [osg-users] 2D drawing over a 3D drawing

 

Hi All.
I need to draw a 2D drawing (a single wireframe rectangle) over a 3D drawing
of a scene. Basically I need it to show a window selection in the scene.

In OpenGL, I would set a perspective projection like glFrustum(.), draw the
scene, then set a glOrtho2D(.), and draw the rectangle. Finally I would call
a swap buffers.

How can I do it with OSG?

I mean, in OSG the projection matrix is associated with a camera. So, should
I use two cameras, one for the 3D scene, the other just for the 2D
rectangle?

In camera::frame there is the swap of the back and front buffers. But I
would like to swap those buffers just at the end, after drawing everything.

So, should I call the drawing of the 3D camera without swapping, then the
drawing of the 2D camera with swapping at the end?

I read in the quick start guide of OSG of the thread for draw traversal.
Since I call camera::Frame twice, does OSG create 2 different threads?

Is there any conflict between those threads, since they draw with different
projection matrices?

 

Thanks in advance

Gianluca Natale

 

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

Reply via email to