I’m trying to render 1D textured lines to indicate relationships between objects. The textured lines always look fine when GL_LINE_SMOOTH is not enabled. However, if I turn GL_LINE_SMOOTH on, and change the modelview matrix such that at least one end of the line is off the viewport, the texturing goes haywire. The texture will stretch until a point at which it actually reverses direction.
It always seems to work perfectly fine when both of the line endpoints are within the viewport. This rendering oddity is even more obvious if the texture is animated to look like it’s flowing one direction, because the animation direction will flip as well when one endpoint is off the screen. This behavior appears regardless of whether I’m using mipmapping.
Here is some example C code (hopefully I’m not missing anything… distilled this out of a much larger project):
//make a line that is easy to tell which direction it is going
struct RGBAColor {unsigned char r, g, b, a; };
for(int i = 0; i < 256; i++)
dots[i].r = dots[i].g = dots[i].b = dots[i].a = (i & 63) * 255 / 64;
glEnable(GL_TEXTURE_1D);
glBindTexture(GL_TEXTURE_1D, 4);
glTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage1D(GL_TEXTURE_1D, 0, 4, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, &dots);
...
glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINES);
glColor4ub(255,255,255,255);
glTexCoord1f(0.0);
glVertex3f(0.0, 0.0, 0.0);
glTexCoord1f(24.0);
glVertex3f(20.0, 10.0, 10.0);
glEnd(GL_LINES);
I’m using an ATI x800 Pro with the Catalyst 6.10 drivers. However, I remember finding this bug one other time about a year ago, and that may have been with my 9800 Pro with obviously older drivers. I don’t have easy access to other brand video cards to try this on.
I know 1D textures aren’t used much, but has anyone else seen this? I’d like to be able to use GL_LINE_SMOOTH, and drawing lines with 1D textures is easier than using cylinders or something.