thebluegnu2000
11-21-2000, 07:54 AM
Hi,
I'm loading a texture that is larger than my implementation allows. The redbook suggests cutting up the source image and loading it as a series of smaller textures then draw them next to each other. I've managed this with no problem. The problem comes when I use the GL_LINEAR glTexParameter option to smooth the textures as black lines appear at the boundaries between them. The redbook acknowledges that this happens and suggests using a texture border (p337). It seems that the texture buffer must be increased in size so it allows a one pixel wide edge to be added on each side (redbook p328)(width is therefore width+(one pixel wide edge times 2 edges) and height is (height +one pixel wide edge times 2 edges). Then the image to be loaded must be the equivalent size with the border included in the image source. Then I use glTexImage2D with the Border parameter set to 1 with the new width and height described.
To test the idea I loaded a red square that was 128 by 128 plus a one pixel border hence 130 by 130 in size hoping to see a complete red square once drawn. Instead I get a square that has black horizontal lines. When I put the Border parameter to 0 and put the texture size back to 128 by 128 I get a red square which implies that the border is causing the problem. This happens on both a UNIX platrom (mesa openGL) and an NT platform. (Using OpenGL 1.1).
Has anyone got any suggestions or even better, a source code example of using textures with borders.
Thanks for your time.
I'm loading a texture that is larger than my implementation allows. The redbook suggests cutting up the source image and loading it as a series of smaller textures then draw them next to each other. I've managed this with no problem. The problem comes when I use the GL_LINEAR glTexParameter option to smooth the textures as black lines appear at the boundaries between them. The redbook acknowledges that this happens and suggests using a texture border (p337). It seems that the texture buffer must be increased in size so it allows a one pixel wide edge to be added on each side (redbook p328)(width is therefore width+(one pixel wide edge times 2 edges) and height is (height +one pixel wide edge times 2 edges). Then the image to be loaded must be the equivalent size with the border included in the image source. Then I use glTexImage2D with the Border parameter set to 1 with the new width and height described.
To test the idea I loaded a red square that was 128 by 128 plus a one pixel border hence 130 by 130 in size hoping to see a complete red square once drawn. Instead I get a square that has black horizontal lines. When I put the Border parameter to 0 and put the texture size back to 128 by 128 I get a red square which implies that the border is causing the problem. This happens on both a UNIX platrom (mesa openGL) and an NT platform. (Using OpenGL 1.1).
Has anyone got any suggestions or even better, a source code example of using textures with borders.
Thanks for your time.