b069bea91ccdffa457c6974fc576271dfabc3859
3 * A skeleton/template GLUT program
5 * Written by Brian Paul and in the public domain.
10 * Revision 1.1 2001/08/21 14:25:31 brianp
11 * simple multi-window GLUT test prog
13 * Revision 1.1.1.1 1999/08/19 00:55:42 jtg
16 * Revision 1.2 1998/11/07 14:20:14 brianp
17 * added simple rotation, animation of cube
19 * Revision 1.1 1998/11/07 14:14:37 brianp
31 static GLint Window
[2];
33 static GLfloat Xrot
= 0, Yrot
= 0, Zrot
= 0;
34 static GLboolean Anim
= GL_TRUE
;
37 static void Idle( void )
43 glutSetWindow(Window
[0]);
45 glutSetWindow(Window
[1]);
50 static void Display0( void )
52 glClear( GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
);
54 glEnable(GL_LIGHTING
);
56 glEnable(GL_DEPTH_TEST
);
59 glRotatef(Xrot
, 1, 0, 0);
60 glRotatef(Yrot
, 0, 1, 0);
61 glRotatef(Zrot
, 0, 0, 1);
72 static void Display1( void )
74 glClear( GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
);
77 glRotatef(Xrot
, 1, 0, 0);
78 glRotatef(Yrot
, 0, 1, 0);
79 glRotatef(Zrot
, 0, 0, 1);
81 glShadeModel(GL_FLAT
);
83 glBegin(GL_TRIANGLE_STRIP
);
99 static void Reshape( int width
, int height
)
101 glViewport( 0, 0, width
, height
);
102 glMatrixMode( GL_PROJECTION
);
104 glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
105 glMatrixMode( GL_MODELVIEW
);
107 glTranslatef( 0.0, 0.0, -15.0 );
111 static void Key( unsigned char key
, int x
, int y
)
113 const GLfloat step
= 3.0;
140 int main( int argc
, char *argv
[] )
142 glutInit( &argc
, argv
);
144 glutInitWindowPosition( 0, 0 );
145 glutInitWindowSize( 400, 400 );
146 glutInitDisplayMode( GLUT_RGB
| GLUT_DOUBLE
| GLUT_DEPTH
);
147 Window
[0] = glutCreateWindow(argv
[0]);
148 glutReshapeFunc( Reshape
);
149 glutKeyboardFunc( Key
);
150 glutDisplayFunc( Display0
);
152 printf("GL_RENDERER[0] = %s\n", (char *) glGetString(GL_RENDERER
));
154 glutInitWindowPosition( 500, 0 );
155 glutInitWindowSize( 400, 400 );
156 glutInitDisplayMode( GLUT_RGB
| GLUT_DOUBLE
| GLUT_DEPTH
);
157 Window
[1] = glutCreateWindow(argv
[0]);
158 glutReshapeFunc( Reshape
);
159 glutKeyboardFunc( Key
);
160 glutDisplayFunc( Display1
);
162 printf("GL_RENDERER[1] = %s\n", (char *) glGetString(GL_RENDERER
));