Hello Constantin,

On 11/02/2010 08:19 AM, Constantin Müller wrote:
> I got some questions concerning the clearing of the stencil buffer.
> I found the StencilChunk function setClearBuffer and found a mailinglist
> thread for the purpose of the function, but I guess I didn't get how to
> use it properly.
>
> I should call stencilChunk->setClearBuffer(1) to clear the stencilbuffer
> before the rendering and setClearBuffer(2) for clearing the buffer after
> rendering, as far as I understand it. Am I supposed to call the function
> with 0 for no clearing? Or has it to be a negative value as for
> background->setClearStencilBit?

yes, 0 for no clearing on the StencilChunk (in fact anything but 1 or 2 
means no clearing).

> Do these two functions collide in their functionality, because I thougt
> the setClearStencilBit would control the clearing of the buffers.

they serve somewhat different purposes. Background::setClearStencilBit() 
is to control the stencil clear at the beginning of rendering to a 
framebuffer (the default one or an FBO), because the background is the 
first thing to draw/clear.
The StencilChunk is mostly useful for multi pass materials where you 
need to clear the stencil buffer between passes for an individual object 
or group of objects. It can be a bit tricky to use though, because 
OpenSG's state sorting will generally render all objects with the same 
material at once, so you are not guaranteed to get a clear before/after 
every object - you can force the materials to be different by setting a 
sort key on them for example.

> PS: Is there any other documentation or description of the functions of
> OpenSG where I could find how to use the setClearBuffer function or
> other functions and what the parameters have to be?

If with 'other documentation' you mean other than the doxygen generated 
one, then no. I usually just look in the .fcd file for a class since it 
contains all the fields of that class with their type and in many cases 
also a short comment.

        Cheers,
                Carsten

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to