[osg-users] 2D drawing over a 3D drawing

Gordon Tomlinson gordon at gordon-tomlinson.com
Mon Mar 23 05:58:11 PDT 2009



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:gordon at GordonTomlinson.com> gordon at GordonTomlinson.com
IM:  <mailto:gordon3dBrit at 3dscenegraph.com> gordon3dBrit at 3dscenegraph.com
 <http://www.vis-sim.com/> www.vis-sim.com
<http://www.gordontomlinson.com/> www.gordontomlinson.com 



From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Gianluca
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

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090323/fd96ae62/attachment-0003.htm>

More information about the osg-users mailing list