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

Gianluca Natale gianluca.natale at adstorino.it
Mon Mar 23 05:29:39 PDT 2009


Thanks a lot,
this is the answer I needed.

Just another question: suppose that I need to draw different 2D drawings
onto the same 3D scene, how can I set the desired rendering order for those
slave cameras?

I mean, I want to make sure that a text will always appear over a 2D
rectangle created onto the 3D scene.

Should I set the camera for the rectangle as
cameraforRectangle::setRenderOrder(osg::Camera::POST_RENDER, 0); and

cameraforText::setRenderOrder(osg::Camera::POST_RENDER, 1); ???

Does it work that way?

 

Thanks,

Gianluca

 

 

From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Robert
Osfield
Sent: lunedì 23 marzo 2009 12.09
To: OpenSceneGraph Users
Subject: Re: [osg-users] 2D drawing over a 3D drawing

 

HI Gianluca,

Please have a look at the osghud example.

Robert.

2009/3/23 Gianluca Natale <gianluca.natale at adstorino.it>

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 at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

 

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.238 / Virus Database: 270.11.24/2018 - Release Date: 03/23/09
06:52:00

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


More information about the osg-users mailing list