The following code seems to work fine on Solaris 8 SPARC (here at work), but won’t draw anything on Redhat linux 9 (at home).
Has anyone had any issues with glut on RH9?
// tester.cpp #include <GL/glut.h> //================================================ void my_init(); void my_display_func(); void my_reshape_func( int w, int h ); //================================================ int main( int argc, char * argv[] ) { glutInit( &argc, argv ); glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH ); glutInitWindowSize( 600, 600 ); glutInitWindowPosition( 50, 50 ); glutCreateWindow( "tester" ); my_init(); glutDisplayFunc( my_display_func ); glutReshapeFunc( my_reshape_func ); glutMainLoop(); return 0; } //================================================ void my_init() { glClearColor( 0.0, 0.0, 0.0, 0.0 ); glEnable( GL_DEPTH_TEST ); } //================================================ void my_display_func() { glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glColor3f( 0.1, 0.7, 0.3 ); glBegin( GL_LINE_STRIP ); glVertex3d( 0.2, 0.2, 0.0 ); glVertex3d( -0.2, 0.2, 0.0 ); glVertex3d( -0.2, -0.2, 0.0 ); glVertex3d( 0.2, -0.2, 0.0 ); glEnd(); glutSwapBuffers(); } //================================================ void my_reshape_func( int w, int h ) { if ( w > h ) { glViewport( w/2 - h/2, // x_bottom_left_corner 0, // y_bottom_left_corner h, // width (x, to the left) h ); // height (y, up) } else { glViewport( 0, h/2 - w/2, w, w ); } glMatrixMode( GL_PROJECTION ); glLoadIdentity(); gluPerspective( 35.0, // fovy 1.0, // aspect 2.0, // near 6.0 ); // far glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); gluLookAt( 0.0, 0.0, 4.0, // eye position 0.0, 0.0, 0.0, // looking at 0.0, 1.0, 0.0 ); // which way is up glutPostRedisplay(); }