NULL_PRT: Thanks for the NV_ext tip.
Are you saying my setup code for depth_stencil texture is wrong?
During the lighting pahse of the derferred engine, I copy the MRT colour texture to the target framebuffer, but select only pixels tagged as “do not light” using a stencil ref value of $01.
[b]bind framebuffer…
set 2D matricies…
glclearcolor (0.0, 0.0, 0.0, 0.0);
glclear (GL_COLOR_BUFFER_BIT);
glenable (GL_STENCIL_TEST);
glStencilFunc (GL_EQUAL, $01, $FF); //pass stencil test if the ref value (equal) to stencil buffer
glStencilOp (GL_KEEP,GL_KEEP, GL_KEEP);
bind MRT colour texture
draw full screen quad[/b]
Next, I render the directional lights are a full screen quad…with add blending…
glenable (GL_STENCIL_TEST);
glStencilFunc (GL_EQUAL, $08, $FF); //pixel to be lit are $08
glStencilOp (GL_KEEP,GL_KEEP, GL_KEEP);
glenable (GL_BLEND);
glblendequation (GL_FUNC_ADD);
glblendfunc (GL_ONE, GL_ONE);
glcolor4f (1,1,1,0.7);
bind all three MRT textures …
enable DirectionalLight shader…
set light uniform params…
draw full screen quad…
disable shader…
unbind framebuffer…
The problem, however, is starting with the fixed function texture copy with stencil enabled.
Disabling the stencil - then I don’t have any stippling artifacts.
NULL_PTR: Can I clarify - are you using depth_stencil texture as part of the framebuffer (or are you using stencil and depth render buffers)?
Considering how all this code works very well on the Geforce 8 - I can’t see how it can be wrong on the Radeon. I’ve also placed in my code extensive checking with glGetError and check at every phase of the rendering (GBuffer, Lighting, Refraction, Reflection, Transparency, postprocess). No errors.
Looking at my Depth_Stencil texture creation code… it looks like I use:
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8_EXT, sizeX, sizeY, 0, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8, nil );
and use GL_LINEAR for min and mag filtering.
Any suggestions with stencil or stencil buffer creation?