Clamp Texturemap leaves line

If I have a quad in my scene and use 1 texture to cover the whole quad with clamping.
ie
glVec3{ 0, 0, 0} => glVec2{ 0, 0}
glVec3{ 0, 1, 0} => glVec2{ 0, 1}
glVec3{ 1, 1, 0} => glVec2{ 1, 1}
glVec3{ 1, 0, 0} => glVec2{ 1, 0}

I downloaded the latest nVidia drivers and now surrounding the quad is a black line. It seems that it is doing a nearest neighbor to get the color of the texel (mipmapping is on) and it is going out of the textures bounds and using black around the edges.

Is this the correct way to do this, or does it seem like a bug in the driver?

Any suggestions as to how to deal with this, besides roll back drivers…

Use GL_CLAMP_TO_EDGE.

Read the documentation about the texture border color (mind the difference to texture borders!) to understand the correct behaviour you saw.

I have tried GL_CLAMP_TO_EDGE

I am on a windows box. So I got the glExt.h file from the OpenGL.org FAQ

glGetString(GL_VERSION) returns 1.4.0

Do I have to manually load the GL_EXT_texture_edge_clamp to use it?

Could this be a bug in the latest NV driver?

It is correct for OpenGL to sample the texture border in a texture. GL_CLAMP_TO_EDGE should fix it however, by making it only sample texels from inside the texture map.

Could you post up your texture intialization code?

What hardware and driver version are your using?

Nutty

[This message has been edited by Nutty (edited 03-21-2003).]

This example is not getting the black line, but is repeating, top line of texels is on the bottome, bottome line of texels is on the top… etc.

void loadBitmap()
{
// … file read

//Build A Texture From The Data
unsigned int ID;
glGenTextures(1, &ID);						//Generate OpenGL texture IDs

glBindTexture(GL_TEXTURE_2D, ID);			//Bind the texture to a texture object 

glTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);	//Filtering for if texture is bigger than should be
glTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);	//Filtering for if texture is bigger than should be

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);	//Filtering for if texture is bigger than should be
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);	//Filtering for if texture is smaller than it should be

gluBuild2DMipmaps(GL_TEXTURE_2D, bpp, width, height, GL_RGB, GL_UNSIGNED_BYTE, data);

}

// Drawing function
void display()
{
glClear(GL_COLOR_BUFFER_BIT);

glEnable(GL_TEXTURE_1D);
glEnable(GL_TEXTURE_2D);
	
glBegin(GL_QUADS);
glColor3f(1.0f, 1.0f, 1.0f);
glTexCoord2i(0,0);
glVertex2f(-0.95f,-0.95f);
glColor3f(1.0f, 1.0f, 1.0f);
glTexCoord2i(1,0);
glVertex2f(0.95f,-0.95f);
glColor3f(1.0f, 1.0f, 1.0f);
glTexCoord2i(1,1);
glVertex2f(0.95f,0.95f);
glColor3f(1.0f, 1.0f, 1.0f);
glTexCoord2i(0,1);
glVertex2f(-0.95f,0.95f);
glEnd();
glFlush();

}

Oh, I see a bug, 1D and 2D…

Ok, GL_CLAMP_TO_EDE does work.

Zooming up on the screen shot, there is still a line of black but that is no biggie.

Seems to work very well.

Thnx