Stencil buffer functions

Hi!

It would be good, when I could give other functions for the front facing and backfacing polygons.
This feature would eliminate the need of sending the polygons twice to the hardware at stencil shadows.
(and it’s easily implementable in hardware, I think)

Hi,

Lucky for you, this functionality already exists. It’s called “two sided stencil” and it’s exposed through an extension.

-Ilkka

Thanks. I will see it.

Hi!
It is called GL_EXT_stencil_two_side. Also … látom te is magyar vagy és remélem beszélsz is magyarul. Ha esetleg néha tarhatnánk némi haditanácsot akár email keresztül az jó lenne. Sajna nem nagyon ismerek magyar nyelvû OpenGL profit akivel meglehetne beszélni eztazt. Because this is a multilangual forum, here is the translation for the above text: I see that you are from Hungary, and hopefully speak hungarian too. If we could chat sometimes even using email would be great since it is hard to find someone in Hungary who is advanced in OpenGL. Thanks - Köszönöm!

Dan Fekete

I was wondering, what about stencil branching? If the stencil test passes, go to one routine, otherwise go to another routine. This way, you wouldn’t have to pass vertices multiple times, once for one condition, and then again for other conditions. Doesn’t this sound useful? Just pass a set of vertices in, and depending on the stencil test result, branch to different code paths to deal appropriately with the result.

Please how would you represent a “code path” or a “routine” in the GL ? A function pointer ? a new type of program (a “stencil program” just like vertex and fragment programs) ?

For a stencil test normally you can give 3 operations:

  1. stencil test fail
  2. stencil test pass, z test fail
  3. stencil test pass, z test pass
    It’s a very good feature, but you can’t seperate vertices by front and back face so you have to do this in two pass with culling.
    The new feature, we speaking about able to do this (so you can give 6 independent operation).

Originally posted by vincoof:
Please how would you represent a “code path” or a “routine” in the GL ? A function pointer ? a new type of program (a “stencil program” just like vertex and fragment programs) ?

I don’t exactly understand.
The stencil operations I can give, is enough for me.

Originally posted by Andrew Csikvári:
The stencil operations I can give, is enough for me.

So you’re lucky, because the EXT_stencil_two_side extension does exactly that.