Hello Constantin,

Constantin Müller wrote:
> What I'm up to is to render a Scene slice by slice into a
> Stencilbuffer and save this Buffer-values.
> I have to render the scene at least 2 times for every slice, one time
> with frontface-culling, second time with backface-culling.
> After this two rendering passes I need the value of the stencil buffer.
> 
> I got the testStage example running and wanted to modify the file for my 
> needs.
> 
> Now I can't really see, where I have to or better where I could modify
> the parameters for the rendering.
> 
> Here is some OpenGL code, doing what I want to do in OpenSG.
> 
>         // first rendering
>       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | 
> GL_STENCIL_BUFFER_BIT);
>       glClearStencil(0x0);
> 
>       glMatrixMode(GL_MODELVIEW);
>       glLoadIdentity();
> 
>       glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
>       glDepthMask(GL_FALSE);
>       glEnable(GL_STENCIL_TEST);
>       glEnable(GL_CULL_FACE);
> 
>       glCullFace(GL_FRONT);
>       glStencilFunc(GL_ALWAYS,0,0xff);
>       glStencilOp(GL_KEEP, GL_INCR, GL_INCR);
> 
>       drawGeometry();
> 
>       //second rendering
>       glCullFace(GL_BACK);
>       glStencilOp(GL_KEEP, GL_DECR, GL_DECR);
>       glStencilFunc(GL_ALWAYS,0,0xff);
> 
>       drawGeometry();
> 
> Where can I clear the Buffer-bits and the Buffers themselves?

clearing of buffers is controlled by the Background of your Viewport.

SFInt32 _sfClearStencilBit is the value written to the stencil buffer 
(negative values mean the buffer is not cleared).

SFReal32 _sfDepth is the clear depth.
SFBool   _sfClearDepth controls if the depth buffer is cleared
SFBool   _sfClearColor controls if the color buffer is cleared

> Where can I set the Stencil-Function-Parameters or the Stencil-Operations?

This is controlled by the StencilChunk. You can either add one to all 
your Materials or place a Node with a ChunkOverrideGroup near the root 
of your scene.
Front/Backface culling is controlled by the PolygonChunk (SFCullFace).
ColorMask is controlled by the ColorMaskChunk and DepthMask by the 
DepthChunk.

        Cheers,
                Carsten

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to