Projective Shadow Has Black Boxes Everywhere

I’m trying to do projective shadowing and I’m getting the following issue.

I don’t understand why I’m seeing those black boxes then semi-black boxes on the screen. I set the bodercolor of the texture to white but they’re still there, and I have clamping on also. Here’s my code for updating the shadow texture:

glBindTexture(GL_TEXTURE_2D, depthtexture);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, TSIZE, TSIZE, 0);
float bcolor[]={1,1,1,1};
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, bcolor);

Would the problem perhaps be somewhere in this code?

Well I tried changing the last paramter of glCopyTexImage2D, which is the border parameter, to 1 since I am setting the border color for the texture. But after doing that, now the shadow texture is blank, I don’t get any shadows. Any ideas on this?

Now I set the GL_CLAMP to GL_CLAMP_TO_BORDER and set the border color to {1,1,1,1} and those stretched black lines are gone, but now the image consists of basically 4 squares, 1 white and 3 black looking like this

| *****
| *****

I hope that makes sense, basically the open area is the light’s point of view and where the objects are rendered using black color. But the rest of that square, to the right, left and behind the light are rendered as black for some reason. I’ve looked up GL_CLAMP in the forums and a lot of people have had problems with this and said use GL_CLAMP_TO_BORDER but this isn’t working in this situation.

here’s a pic of what it looks like now.

and i’m using a radeon 9800 pro, so it’s definitely not an OpenGL < 1.2 issue…I think

I hope nobody think i’m crazy for posting so many times on my own question, don’t bash me or anything…cough cough Korval…

but I found out that if i make the shadowmap resolution 512x512, instead of 1024x1024 like I’ve been doing, I don’t get that black box. why the heck does it do this?

If you run it with a screen resolution of 1280x1024 and a shadow map res of 1kx1k, do you still get the black boxes?

If you’re not using pbuffers to render the depth texture, you can’t have the texture larger than your viewport.

Ah yes, you guys are right. I changed the viewport and it works fine. Thanks alot.