Texture clamping


(damocles) #1

Is there any way to enable GL_CLAMP_TO_EDGE for a specific texture/shader?

I have a translucent light cone texture and it’s a bit annoying having to make the texture stretch slightly bigger than the faces it occupies so you don’t get sparklies at the end form the wrap around texturing.


(ydnar) #2

Use clampmap instead of map in the shader:

clampmap textures/yourstuff/yourtexture.tga

You might also consider adding nomipmaps to the shader as well, so when it’s further away the edges won’t show.

Keep in mind that Q3A clamping is GL_CLAMP, not GL_CLAMP_TO_EDGE. The border color is always black/transparent, so keep the pixels of your image at least 1 pixel away from the texture edge.

y


(damocles) #3

That’s perfect - thanks ydnar.