PDA

View Full Version : ATI Texturing Problem ...



Andrew Jameson
11-15-2004, 01:30 PM
We're stuck ... and have no immediate access to an ATI card !

The problem that we've got relates to a recently reported fault where a texture seems to end up being incorrectly rendered on some ATI based systems. From the screenshots that we've received it looks as though at the top of the strip that the texture has been rotated by 90 whereas at the bottom of the strip, the texture has been rotated by -90. (The texture in question is 32 x 8 ... if that's relevant).

The particular code is question is listed below and similar code is used in the rest of our application without this problem ... any ideas ?

Many thanks,

Andrew

-----------------------------

cTexCoords : array[0..3] of TGLArrayi2 = ((0, 0), (0, 1), (1, 0), (1, 1));
cGutter : array[0..3] of TGLArrayf3 = ((0.000, 0, -3.45), (0.000, 0, 3.45), (0.450, 0, -3.45), (0.450, 0, 3.45));

glNewList(fPageRightList+1, GL_COMPILE);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, @cMaterialSpecularNone );
glBindTexture(GL_TEXTURE_2D, GLTextures[cBookPageGutter]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2iv(@cTexCoords[0]); glVertex3fv(@cGutter[0]);
glTexCoord2iv(@cTexCoords[1]); glVertex3fv(@cGutter[1]);
glTexCoord2iv(@cTexCoords[2]); glVertex3fv(@cGutter[2]);
glTexCoord2iv(@cTexCoords[3]); glVertex3fv(@cGutter[3]);
glEnd;
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, @cMaterialSpecularDefault);
glEndList;

sqrt[-1]
11-15-2004, 03:46 PM
I firstly would not advise putting tex parameters in display lists but anyway...

Nvidia have a old known "issue" that they interperate
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);

as

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);

so perhaps change to GL_CLAMP_TO_EDGE and see if that fixes it.

Andrew Jameson
11-15-2004, 10:24 PM
Thanks for that ... I'll give that a try ... perhaps I can learn a little more ...

I firstly would not advise putting tex parameters in display lists ... why ?

Andrew

sqrt[-1]
11-16-2004, 03:04 AM
A lot of drivers only optimize display lists if they only contain draw calls.

Note that glTexParameter setting are bound to the texture object so you can typically just set them when you create the texture. (Unless you change the texture setting for different renders)

sqrt[-1]
11-16-2004, 03:12 AM
Just another "guess", perhaps you could try using floats as the texture coordinates instead of ints? (floats are used in most cases)

Andrew Jameson
11-16-2004, 10:04 AM
Thanks ... it was the GL_CLAMP ! The problem of diagnosis was not only hampered by not having access to an ATI card but by the fact that the texture in question was a gradient which completely concealed what was happening.

Once again thanks !

Andrew