From: Allen B. <ba...@lo...> - 2001-05-02 20:23:31
|
Hi (yet again), (Thanks Keith and Brian for your earlier responses.) So, here is my problem code reduced to a simple GLUT program. Basically, I'm creating two display lists which contain only the geometry of a polygon, one to display the edge and the other for the filled interior. I then create another display list which sets an edge color, calls the display list for the edge, sets an interior color and calls the display list for the filled polygon. The redraw function just calls the combined display list. This works OK with XFree86 DRI using the TDFX driver and with XFree86 with LIBGL_ALWAYS_INDIRECT set; you get a blue triangle with a red edge. With the latest CVS version of Mesa, however, when the window is opened you only see a white triangle. Causing a refresh in the window yields a blue triangle but with no red edge (but I think it's drawing the edge in blue). [This is using the KDE window manager, if that matters.] I also see a little empty space between the diagonal edge of the filled polygon and its edge when using either version of the software rendering (indirect DRI or Mesa). I've tweaked PolygonOffset several ways, but can't see to make it go away. I await to be corrected :-) Thanks, Allen -------------------------------------------------------------------------- #include <GL/glut.h> GLuint edge_list; GLuint solid_list; GLuint display_list; void init ( void ) { edge_list = glGenLists( 1 ); solid_list = glGenLists( 1 ); display_list = glGenLists( 1 ); glEnable( GL_POLYGON_OFFSET_FILL ); glEnable( GL_DEPTH_TEST ); glNewList( edge_list, GL_COMPILE ); glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); glBegin( GL_POLYGON ); glVertex3f( 0., 0., 0. ); glVertex3f( 1., 0., 0. ); glVertex3f( 0., 1., 0. ); glEnd(); glEndList(); glNewList( solid_list, GL_COMPILE ); glPolygonOffset( 1., 1. ); glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); glBegin( GL_POLYGON ); glVertex3f( 0., 0., 0. ); glVertex3f( 1., 0., 0. ); glVertex3f( 0., 1., 0. ); glEnd(); glEndList(); glNewList( display_list, GL_COMPILE ); glColor3ub( 255, 0, 0 ); glCallList( edge_list ); glColor3ub( 0, 0, 255 ); glCallList( solid_list ); glEndList(); } void display ( void ) { glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glCallList( display_list ); glutSwapBuffers(); } int main ( int argc, char* argv[] ) { glutInit( &argc, argv ); glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH ); glutInitWindowSize( 300, 300 ); glutCreateWindow( argv[0] ); init(); glutDisplayFunc( display ); glutMainLoop(); return 0; } |