You can use an additional Camera for this, but that's really overkill for a fullscreen quad.

I would just draw a quad. Use a low render bin so that it renders first. Use a vertex shader to do the transform (make it fullscreen and put it on the far plane) and a fragment shader for the texturing. Set the depth test to ALWAYS and disable the parent camera clear.

Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ <http://www.skew-matrix.com/>
+1 303 859 9466



Trajce Nikolov wrote:
Hi Alessandro,

nah. That wont do the job. I did a quick test, and here is how I made it
work

go the the osgHUD example and:

1. createHUD, set for the camera:
camera->setRenderOrder(osg::Camera::NESTED_RENDER);

2. in main, about line 362, where you load your scene without arguments
osg::ref_ptr<osg::Group> group  = new osg::Group;
osg::Node* one = createHUD(); // this will be your background image
osg::Node* two = scene.get();
one->getOrCreateStateSet()->setRenderBinDetails(1,"RenderBin");
two->getOrCreateStateSet()->setRenderBinDetails(2,"RenderBin");
group->addChild(one);
group->addChild(two);
group->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
two->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::ON);

// add the HUD subgraph.
//if (scene.valid()) group->addChild(scene.get());
//group->addChild(createHUD());

// set the scene to render
viewer.setSceneData(group.get());


this is working code. Might be another way, but this will help you I think

Let me know if it works for you

Nick

http://www.linkedin.com/in/tnick
Sent from Ünalan, İstanbul, Turkey

On Sat, Dec 19, 2009 at 11:16 AM, alessandro terenzi <a.tere...@gmail.com>wrote:

I'd like to create a fixed background for an osg application, much like a
HUD but while the HUD is always on top of the scene, I need to have an image
always behind any 3D object.

I tried to modify the example about HUDs by changing:

setRenderOrder(osg::Camera::POST_RENDER);

into this:

setRenderOrder(osg::Camera::PRE_RENDER);

but I guess that this is not sufficent to achive my goal, because actually
the background image is not displayed at all (or maybe it is covered by the
scene...).

How can I create the desired effect?
Thanks in advance.
Alessandro

_______________________________________________
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
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to