Partially offscreen polygons are rendered incorrectly. Visible part of them is misplaced and texture coordinates are sometimes set to random values. Problem appears only when clipping to viewport, polygons that are fully located inside the viewport are rendered correctly. Here's what glxinfo says about renderer: OpenGL vendor string: Gareth Hughes, Leif Delgass, José Fonseca OpenGL renderer string: Mesa DRI Mach64 [Rage Pro] 20051019 AGP 2x OpenGL version string: 1.2 Mesa 6.4.2 I'm not the sole "victim", the same problem with Mach64 driver (on another card) is described by another user here (you can get some screenshots there): http://www.linuxquestions.org/questions/showthread.php?p=2368337 I'm attaching code that reproduces the problem with clipping. ---------------------8< cut here 8<---------------------------------- #include <GL/glut.h> void display(void) { glClearColor( 0.0, 0.0, 1.0, 0.0 ); glClear( GL_COLOR_BUFFER_BIT ); /* The white triangle is located inside the viewport and is rendered correctly */ glColor3f( 1.0f, 1.0f, 1.0f ); glBegin( GL_TRIANGLES ); glVertex2f( 0.25f, 0.25f ); glVertex2f( 0.75f, 0.25f ); glVertex2f( 0.5f, 0.85f ); glEnd(); /* The red triangle is partially offscreen and various clipping artefacts occur during render. When rendered correctly, the red triangle should look the same as white one, just translated to the left */ glColor3f( 1.0f, 0.0f, 0.0f ); glBegin( GL_TRIANGLES ); glVertex2f( -0.15f, 0.25f ); glVertex2f( 0.35f, 0.25f ); glVertex2f( 0.1f, 0.85f ); glEnd(); glutSwapBuffers(); }; int main(int argc, char **argv) { glutInit( &argc, argv ); glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA ); glutInitWindowSize( 640, 480 ); glutCreateWindow( "ATI Mach64 driver bug?" ); gluOrtho2D( 0, 1, 0, 1 ); glutDisplayFunc( display ); glutMainLoop(); return 0; }
Created attachment 7478 [details] [review] un-break strict-aliasing rules Does this help?
Created attachment 7530 [details] [review] use union's instead of memcpy's
commited (eed1a6de4b396ed6305cf34812a269c10c746d3c)
Mass version move, cvs -> git
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.