Well, after tabling the performance issue for the moment, I’ve moved on to the next step and I’m having the following issue:
If I create a color texture and copy the pbuffer to it with glTexSubImage2D, I can render it on a quad no problem. It shows as a color image of the view from the light.
But if I create a depth texture with:
glGenTextures(1,&depth_map);
glBindTexture(GL_TEXTURE_2D,depth_map);
glTexImage2D(GL_TEXTURE_2D,0,depth_format,TEX_SIZE,TEX_SIZE,0,GL_DEPTH_COMPONENT,GL_UNSIGNED_INT,0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB,GL_LEQUAL);
and copy the pbuffer to it with:
glBindTexture(GL_TEXTURE_2D,depth_map);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, TEX_SIZE,TEX_SIZE);
When I render the quad with:
glBindTexture(GL_TEXTURE_2D,depth_map);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
glTexParameteri(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexParameteri(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE);
glTexParameteri(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
glTexParameteri(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
glBegin(GL_QUADS);
// Start drawing the map as a textured QUAD
//Assign the texture coordinates and vertices
glTexCoord2f(1.0f, 0.0f); glVertex3f(x + width, y, 0);
glTexCoord2f(1.0f, 1.0f); glVertex3f(x + width, y + height, 0);
glTexCoord2f(0.0f, 1.0f); glVertex3f(x, y + height, 0);
glTexCoord2f(0.0f, 0.0f); glVertex3f(x, y, 0);
glEnd();
SRC_ALPHA);
All I get is a white quad.
Any ideas?
Thanks in advance for any help/insight
[This message has been edited by azcoder (edited 09-12-2003).]