View Full Version : Question about texture mapping

09-28-2011, 02:23 AM

I have a question about texture mapping in my program.
I was able to implement Projective Texture mapping correctly in which I load an image and use that as a texture for projection.
The question is that depending on where my camera is or in other words when the texture is out of range [0,1], the texture repeats.
In order to handle this, I used glTexParameteri with GL_CLAMP on both s and t. It seems working but now, another question is that it will look something similar to this:
I want my texture to show only the lower left without having those vertical or horizontal stripes...
So something like this:
So I am using GLSL to compute projective texture coordinate and use texture2DProj to draw it.
Is there anyway I can do this? Could someone help me on this?

Thank you so much!

09-28-2011, 07:51 AM
Maybe you can manually set all texels in the border of the texture to black?
Or set them with max transparency.

09-28-2011, 09:10 AM
Set the clamp mode to GL_CLAMP_TO_BORDER instead and specify a black border color.

09-28-2011, 04:01 PM
Thank you so much! That's what I wanted it and it worked perfectly! :)