On Mon, Jun 11, 2012 at 12:31 PM, Gianluca Natale
<nat...@europe.altair.com> wrote:
> 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.
Yes
>
> 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.
...
A less intrusive way to do this is with slave cameras. The main scene
is drawn in a slave. Another slave camera draws your dragger by having
it as its child. Its clear mask is set to GL_DEPTH_BUFFER_BIT.

Tim

> 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-users-boun...@lists.openscenegraph.org 
> [mailto:osg-users-boun...@lists.openscenegraph.org] Per conto di Bob Slobodan
> Inviato: lunedì 11 giugno 2012 10:15
> A: osg-users@lists.openscenegraph.org
> Oggetto: Re: [osg-users] Depth test and RenderBin details
>
> Hi guys,
> First of all, thank you for the answers. Unfortunately, I couldn't solve my 
> problem. I already tried the first solution that consisted in giving 
> different render bin to the axis and the sphere, but then I either have the 
> sphere always on top of the axis, or the axis always on top of the sphere.
>
> This image illustrates my problem :
>
> [Image: http://img15.hostingpics.net/pics/490598Sanstitre4.png ] 
> (http://www.hostingpics.net/viewer.php?id=490598Sanstitre4.png)
>
> The image 1 illustrates what i have  when the sphere has a lower render bin 
> than the axis. The images 2 and 3 illustrates the opposite.
> The image 4 illustrates a shading problem that I have in both situation.
>
> So what I want is a mix between the image 2 and 5. This is basically what I 
> have when I don't deactivate the depth test and don't use render bin details. 
> But then, if I have anything (like a plane for example) between my dragger 
> and the camera, I won't see it anymore.
>
> Thank you so much for helping me.
>
> Cheers,
> Bob
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=48156#48156
>
>
>
>
>
> _______________________________________________
> 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