another Depth texture question

Well, first of mine I think, but it’s discussed a lot. I have a multisample FBO setup with a depth_stencil_ext attached to the depth attachment. I’ve tried this technique with the attachment being both a texture and a render buffer, same results.

I have a 2nd FBO that is RGBA8 with a depth_component texture attached.

I render to the multisample buffer, then FramebufferBlit the depth from it to the 2nd FBO. The intention is to then use the depth texture as a shader input for screen space techniques for deferred shading/screen space ambient occlusion/edge detection antialiasing/volume effects,etc…

Here is the framebuffer blit code…


	glBindFramebufferEXT( GL_READ_FRAMEBUFFER_EXT, glSource->GetFramebufferID() );
	glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, glDest->GetFramebufferID() );
	glBlitFramebufferEXT(	0, 0, Width, Height, 0, 0, Width, Height, GL_DEPTH_BUFFER_BIT, GL_NEAREST);

Then I reset the draw frame buffer back to fbo 1, and render some effects with the depth texture of fbo 2 as an input. I don’t seem to be getting the actual depth.

Now, I have tried it with fbo 2 the same res as fbo 1, and as a square texture (the blit “should” stretch). I also have shaders written to visualize the depth images being used.

Here is my setup code for the texture going into the shader.


	glActiveTextureARB(GL_TEXTURE1_ARB);
	glDisable(GL_TEXTURE_2D);
	glEnable(GL_TEXTURE_RECTANGLE_ARB);
	glBindTexture(GL_TEXTURE_RECTANGLE_ARB, ((GL_FRAMEBUFFER_INFO *) Renderer->GetDepthFramebuffer())->GetAttachmentID(DEPTH_ATTACHMENT));
	glUniform1iARB(Cache->DepthTextureLoc, 1);
	glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_DEPTH_TEXTURE_MODE_ARB, GL_LUMINANCE);
	glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
	glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);


The shader to visualize is very simple, just this in the fragment…



#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect tex;

void main()
{
	vec4 color = vec4(0.0, 0.0, 0.0, 1.0);
	color = texture2DRect(tex,gl_TexCoord[0].st);
	gl_FragColor = color;
}


As you can see in this screen shot, the shadow map fbo works fine, and displays fine, but the depth fbo doesn’t. It’s as if the fbo blit does nothing. Any suggestions??

Noone has any thoughts eh? I know I’m missing something stupid, as many others obviously have something like this working.