PDA

View Full Version : Black border on texture



kiichle
07-08-2004, 01:12 PM
I have created a radial distortion algorithm in a Fragment Shader that distorts my 2D texture. But, when it distorts, the edges of the texture are streteched inward creating "streaking". I'd like this to be black... I'm thinking that putting a black border on the texture would work. But, I can't figure out how to put a black border on the texture.

Right now, I'm using gluBuild2DMipmaps since my image is not 2^n and when I try and scale it myself using gluScaleImage it comes out very choppy. Is there a way to add a black border to my texture using gluBuild2DMipmaps?

Thanks!

ZbuffeR
07-08-2004, 02:19 PM
Maybe just use texture borders ?
Specify a one pixel wide border with glTexture2D call, set GL_CLAMP_TO_BORDER or something like that, and GL_TEXTURE_BORDER_COLOR to black.

Relic
07-09-2004, 12:01 AM
Allright, but texture border (texels) and texture border color are mutually exclusive.
The texunit can only sample either one and then the texture border color set to black is the easier way here.
Some hardware does not support CLAMP_TO_BORDER.