PDA

View Full Version : CLAMP_TO_BORDER and ARB_Shadow



flamz
10-09-2003, 11:00 AM
Hi,
I'm having problems with my shadow mapping implementation. After the texgen when the UV lies outside the 0,1 range, I want it to clamp to the border color so that it DOES NOT produce any shadow.

However, regardless of the color I set has a border, it always ends up being shadowed. Ie when clamping occurs, that pixel is in shadow.

here's how I define my texture:

glGenTextures(1, &m_itextureObjects[v]);
glBindTexture(GL_TEXTURE_2D, m_itextureObjects[v]);
glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, shadowMapSize, shadowMapSize, 0,GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
float tc[] = { 0.0f, 0.0f, 0.0f, 0.0f };
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, tc);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, CLAMP_TO_BORDER_ARB);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, CLAMP_TO_BORDER_ARB);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);
glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY);

I'm using an ATI FireGL X2.