What I would do in standard OpenGL is this:
1) Draw your whole model first (with depth test enabled);
2) Clean the depth buffer only (glClear(GL_DEPTH_BUFFER_BIT););
3) Draw the dragger (with depth test enabled).
In this way the dragger would always appear on top of the model, no matter its position in the world.
How can you achieve this in a scene graph using OSG?
1) I would set the rendering bin for the whole model to the lowest value, to force it to be drawn first. Keeping depth test enabled during drawing.
2) I would define a CleanDrawable, derived from osg::drawable, whose drawImplementation is just a glClear(GL_DEPTH_BUFFER_BIT). And assign the rendering bin for such drawable to a value
greater than the one assign to the whole model. Then, I would attach a geode containing such drawable somewhere in your scenegraph.
3) I would set for the dragger a rendering bin even greater than that assigned to the CleanDrawable. Keeping the depth test enabled in this case also.
I did do it in my application and it seems to work. But I don't know if there is a better and more elegant solution.
Just my 2 cents.
-----Messaggio originale-----
Da:
osg-user...@lists.openscenegraph.org [mailto:
osg-user...@lists.openscenegraph.org] Per conto di Bob Slobodan
Inviato: lunedì 11 giugno 2012 10:15
A:
osg-...@lists.openscenegraph.org
Oggetto: Re: [osg-users] Depth test and RenderBin details