please help, depth texture rectangle in glsl

For some reason I just cannot get depth values from my texture rectangle depth buffers. I desperately need help as I’ve tried just about everything I can think of.

My color attachment for the texture rectangle also works fine, so I’m sending in the correct arb_texture_rectangle expected texel based UVs

My depth texture_2d stuff works fine, and it uses exactly the same setup for my depth texture rect.

After I bind the texture, I do this…

GLint UniformLoc = -1;
GLuint Program = GetShaderProgramHandle(SHADOWRECT_SHADER);

UniformLoc = glGetUniformLocationARB(Program, "tex");
if (UniformLoc < 0)
   glUniformError(__LINE__, __FILE__);
glUniform1iARB(UniformLoc, 0);

In the texture2d shader I do this

uniform sampler2D tex;
color = texture2D(tex, gl_TexCoord[0].st);
gl_FragColor = color;

In the texture rectangle shader I do this.

uniform sampler2DRect tex;
color = texture2DRect(tex, gl_TexCoord[0].st);
gl_FragColor = color;

When sending texture2d quads I use UVs from 0.0-1.0, when sending texturerect quads UVs are 0.0-tex_size.xy

So I’m REALLY at a loss here, any help?



OK, I assume you had depth texture2D working at some moment and now want to use TextureRectangle.

Q1: Make sure this function is called when your depth texture is attached to GL_TEXTURE_RECTANGLE_ARB bind point, before you are trying to read from it.

Q2: What do you see as a result?

P.S. This shouldn’t be difficult: I’m using depth rectangles for quite a long time already.

Ah, this was my own stupidity, I forgot to resolve the multisamples on the depth buffer in my frambuffer blit! duh…