[osg-users] Combine geodes
Robert Osfield
robert.osfield at gmail.com
Fri Jan 15 06:13:54 PST 2016
Hi Artem,
The osgreflect example is rather basic and very old so doesn't
illustrate the clear mask (it's one of our very first example
programs.)
The osg::Camera has support for controlling the OpenGL clearing, from
include/osg/Camera header:
/** Set the clear mask used in glClear().
* Defaults to GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT. */
inline void setClearMask(GLbitfield mask) { _clearMask = mask;
applyMaskAction(CLEAR_MASK); }
/** Get the clear mask.*/
inline GLbitfield getClearMask() const { return _clearMask; }
The way you'd use in the context of stencilling would be to set up
either the master camera to clear the stencil buffer, or use a
multi-pass approach with osg::Camera embedded in the scene graph to
create multiple render stages each with their own clear - the osghud
example illustrates this. Alternatively you use viewer slave Camera
to do multi-pass, again the osghud example illustrates this.
Robert.
On 15 January 2016 at 12:20, Artem Ivanov <tema.krukovets at gmail.com> wrote:
> Actually, I have some more questions about using stencil buffer:
> - how can I clear stencil buffer on render bin? (in OpenGL tutorials everyone uses glClear(GL_STENCIL_BUFFER_BIT)
> - is it possible to disable stencil buffer at the begining of the render bin and enable it at the end? Or should I disable usage of the stencil buffer on previous render bin and enable it on next?
>
>
> robertosfield wrote:
>> On 13 January 2016 at 18:49, Artem Ivanov <> wrote:
>>
>> > Thanks for your responses.
>> > Actually, I want only visual effect (like union operation on two geometries), so I think it is about pure rendering.
>> > It would be great if you can describe this method or provide some information about it.
>> >
>>
>> To understand the ideas behind managing the rendering It would
>> probably be easiest to just read up online one how to do such
>> rendering using OpenGL. Topics to look into would be OpenGL, Stencil
>> Buffer Consutrctive Solid Geometry.
>>
>> Perhaps members of the community have their favourite tutorials on this topic.
>>
>> The OSG fully supports stencilling, controls on depth+color buffers,
>> shaders, controls for managing multi-pass rendering. The osgreflect
>> example provide a very simple example of managing stencilling.
>>
>> Robert
>> _______________________________________________
>> osg-users mailing list
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>> ------------------
>> Post generated by Mail2Forum
>
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=66027#66027
>
>
>
>
>
> _______________________________________________
> 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