[osg-users] Draw through a mask
Robert Osfield
robert.osfield at gmail.com
Tue Apr 4 00:41:14 PDT 2017
Hi Jorome,
The standard way in OpenGL/OSG to do this is to use the stencil
buffer. The osgreflect example illustrates one approach to using
stencilling. You can also use multiple passes set up using osg::Camera
that clear/set the stencil buffer.
An alternative would be to use clip panes, see osgclip example.
Another alternative would be to use shaders to flip out the fragment
you don't want, this can also be done using fixed function pipeline
with use of projective textures with alpha values.
Robert.
On 3 April 2017 at 13:24, Jérôme Desfieux <jerome.desfieux at gmail.com> wrote:
> Hi,
>
> I have an osg::Geometry (a long rectangle above a terrain).
> But I want it to be really drawn only through a mask (this mask is for example a small square I can move on the terrain; it reveals the long geometry through it; other parts of the long geometry must not be drawn)
>
> What is the good approach for realizing this task?
>
> (note i am using OsgEarth, but as far as i know it does not provide a such feature).
>
> Thank you!
>
> Cheers,
> Jérôme
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=70638#70638
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
More information about the osg-users
mailing list