Oops forgot to attach the source code.... Scott McMillan wrote: > > I have been playing with scaling the texture matrix and I have > come across a weird result on my Linux box running Mesa 3.0 > (that doesn't show up on my SGI at work). > > The attached program scales the texture matrix (2, 2, 0), and > renders a textured triangle strip with texture coords in the > range [0, 1] (the result looks like I have an identity texture > matrix with texture coords in the range [0, 2] and I have set > clamp. > > The resulting texturing gets messed up in area outside the normal > texture (where the CLAMP causes the edge pixel to be "stretched" > across the polygon), but (and this is the good part) ONLY WHEN THE > POLYGON GETS TOO CLOSE TO THE VIEW. > > Can anyone else recreate this in current beta versions (I am still > trying to set up CVS at home)? If so, is this a bug or just an > area outside of the spec? > > Regards, > scott -- Scott McMillan mailto:[EMAIL PROTECTED] Cambridge Research Associates http://www.cambridge.com 1430 Spring Hill Road, Ste. 200 Voice: (703) 790-0505 x7235 McLean, VA 22102 Fax: (703) 790-0370
#include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> #include <math.h> //---------------------------------------------------------------------------- #define imageSize 64 GLubyte checkImage[imageSize][imageSize][4]; void makeCheckImage() { int i, j, c; for (i=0; i<imageSize; i++) { for (j=0; j<imageSize; j++) { c = (1 - (((i&0x8)==0)^((j&0x8))==0))*255; checkImage[i][j][0] = c; checkImage[i][j][1] = c/2; checkImage[i][j][2] = 0; checkImage[i][j][3] = 255; } } } //---------------------------------------------------------------------------- void myInit() { glClearColor(0,0,0,0); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); makeCheckImage(); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexImage2D(GL_TEXTURE_2D, 0, 4, imageSize, imageSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, &checkImage[0][0][0]); 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_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); glEnable(GL_TEXTURE_2D); } //---------------------------------------------------------------------------- float mytime = 0.0; void display() { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); mytime += 0.1; glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(-1.5, 0.0, -4.6 + cos(mytime)); glBegin(GL_TRIANGLE_STRIP); { glTexCoord2f(0.0, 0.0); glVertex3f(1.0, -1.0, 0.0); glTexCoord2f(0.0, 1.0); glVertex3f(1.0, 1.0, 0.0); glTexCoord2f(1.0, 0.0); glVertex3f(2.41421, -1.0, -1.41421); glTexCoord2f(1.0, 1.0); glVertex3f(2.41421, 1.0, -1.41421); } glEnd(); glFlush(); glutSwapBuffers(); } //---------------------------------------------------------------------------- void myReshape(GLsizei w, GLsizei h) { glViewport (0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0, (GLfloat)w/(GLfloat)h, 1.0, 200.0); glMatrixMode(GL_TEXTURE); glPushMatrix(); glScalef(2.0, 2.0, 1.0); } //---------------------------------------------------------------------------- int main(int argc, char** argv) { glutInit(&argc, argv); glutInitWindowSize(700, 512); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutCreateWindow("texScaleTest"); myInit(); glutReshapeFunc(myReshape); glutDisplayFunc(display); glutIdleFunc(display); glutMainLoop(); return 0; }