Clamp tex coords to sub tex

Hi, I have an application that uses many textures of various sizes. For various reasons I am sharing a PBuffer between these textures and rendering them through the pbuffer. Now, the pbuffer has to be large enough to cater for the largest texture, which means that some of the textures will get subloaded into a portion of the larger texture.

The problem that I have is that the linear texture filtering that I am using results in artefacts around the outside of the smaller textures due to the interpolation with data that effectectively is outside of the required texture (although still actually inside the complete OpenGL texture).

It seems to that what I really want is the ability to clamp the texture coords at something other than 0->1. Does anyone know of a way (other than shaders) that this can be done?


Make a border around the texture filled with a border color. The border color can be an extension of the border pixels.
This might be difficult to do since you are doing RTT. Doing it for predefined textures is easier because the artists can handle it.

Fixed function doesn’t have that ability.

I have considered the border approach, but as you say, for RTT this is a complication I can do without.

It seems that this would be a useful addition to the fixed function pipeline since it is a natural extension of the whole sub-texture ethos.

Thanks for your input V-man! At least you have confirmed what I had suspected in that it is not possible.

If you don’t need to repeat these textures, then you just need proper texture coordinates (from center of first texel to center of last texel). If for some reasons you need some kind of 1:1 mapping then drawing 1-pixel border along two edges of texture - this border would be additional column and row of your texture and would be exact copy of first column and row in this texture.