PDA

View Full Version : Grey border around texture?



03-06-2001, 11:08 AM
I have texture 128x128x32, it is pure white (FF). Now, when I use texture on a rectangle, there is a grey border around texture! Why? First I thought this AA, but then I change background color to pure white also, and I still see grey border around the texture! This should not be case, but I don't know why this is happening. I try to set to GL_FLAT from GL_SMOOTH, but no difference.

Anyone know why this happen?

This is code



// Texture parameters
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R, GL_LINEAR_MIPMAP_LINEAR);

// Build mip-maps
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 128, 128,GL_RGB, GL_UNSIGNED_BYTE, dat);

..then draw code

glBindTexture(GL_TEXTURE_2D, Tex);
glBegin(GL_QUADS);
glTexCoord2d(0.0, 0.0) ;
glVertex2d( -1, -.05);
glTexCoord2d(1, 0.0) ;
glVertex2d( 1, -.05);
glTexCoord2d(1, 1) ;
glVertex2d( 1, .05);
glTexCoord2d(0, 1) ;
glVertex2d(-1, .05);
glEnd();


Help!

j
03-06-2001, 12:18 PM
Your border color for your texture is probably black.

You can change it with:




glTextureParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, *float);


Where *float is a pointer to an array of 4 floats that define the color.

j

[This message has been edited by j (edited 03-06-2001).]

03-06-2001, 01:04 PM
That no work. http://www.opengl.org/discussion_boards/ubb/frown.gif

I did:



float floata[4]={1,1,1,0};
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, floata);

I sill see grey scale on the borders. It is doing | ||white| || where the | are grey shaded going dark grey to white dark is outside edge.