zbuffer writes and polygon smooth questions
Here ar two unrelated questions:
I'm drawing a regular grid of per pixel lighted quads (just dot3) that to the user appear to always be in the x-y plane. In reality I use an ortho3d and glVertex3f calls with a computed Z value at each quad vertices that is just meaningful to transform the 3d vertex into 2d screen coordinates . I have no use of the interpolated z value at all. However i really need to store specific Z value for each texel of the quad that are not related to the orignal Z of the glVertex call. This could be 1's for a zone of the quad, 2's for another zone and so on.
I've not figured how to do this because my vertices are in 3d with already a Z. In 2d it is
quite easy : use multiple passes using the alpha test for each zone for example. Is there a
way to write to the zbuffer without using glVertex3f or a vertex program (I can't use that) ? For now I'm using the stencil buffer as a pseudo zbuffer.
I'm drawing concave polygons tesselated with glu tesselator and when enabling GL_POLYGON_SMOOTH I
have the well known problem of artefacts at the edges of the concave polygon due to blending. I
tried the method described in the red book using GL_SRC_ALPHA_SATURATE but couldn't make it
work. Anybody had it to work ? is it not too slow with a few complex concave polys ? Is there
a better solution ? I can't use FSAA, which works great
Re: zbuffer writes and polygon smooth questions
Good question... I don't think I can answer your first question directly, but lemme throw you a bone... You could turn off all other buffering, and render your zones into the depth buffer using the same glVertex3f calls. Now if you want to do this with an ortho view, that should be very simple.
As for your second question, I really don't think I can help you there. If you're suffering jaggies, then I suggest you try jittering your render, although that will multiply your render time by the number of jitter passes you render... But I am not terribly familiar with gluTess objects, since I never cared to use them myself... I just tesselate what I need to tesselate myself.