Idea for decals

Allowing glStencilfunc or something similar that is legal between glBegin/End, so each polygon in the scene can have a different stencil value, then, decals can have a stencil value that equals a corresponding primitive so they can be perfectly clipped, and no z-fighting can occur (the polygons have already detirmined visibility, so all you have to do is shove 'em on top)

i sound quite unclear, so reply if you don’t understand/or have comments

And exactly how would the driver interpret such call sequencies? How would it draw a triangle with one stencil function at one vertex and another one on the other vertices?

Originally posted by Humus:
And exactly how would the driver interpret such call sequencies? How would it draw a triangle with one stencil function at one vertex and another one on the other vertices?

One for each quad/tri/whatever, not each vertex. You could have something like glStencil1i(GLint value); for each 2/3/4/n vertices depending on what primitive you specified in glBegin

So, you want the spec to say something like, “You are only allowed to call glStencil after a whole primitive has been defined”?

Now, since the user CAN call glStencil when a primitive is being defined (after two vertices of a triangle, for example, as Humus said), you MUST take care of that situation also! What do you suggest should happen?

[This message has been edited by Bob (edited 04-16-2002).]

Originally posted by Bob:
[b]So, you want the spec to say something like, “You are only allowed to call glStencil after a whole primitive has been defined”?

Now, since the user CAN call glStencil when a primitive is being defined (after two vertices of a triangle, for example, as Humus said), you MUST take care of that situation also! What do you suggest should happen?

[This message has been edited by Bob (edited 04-16-2002).][/b]

I guess the last glStencil called while the primitive is being defined is the one used when the polygon is being rasterized…

like
glBegin(GL_TRIANGLES);
glStencil(1);
<three vertices> //this tri uses 1
<vertex>
glStencil(2);
<2 vertices> //oops…the end of 3 vertices…2 is used since it was the last one specified.

[This message has been edited by willmoores (edited 04-17-2002).]

[This message has been edited by willmoores (edited 04-17-2002).]