1 /* $Id: multiwindow.c,v 1.1 2001/08/21 14:25:31 brianp Exp $ */
4 * A skeleton/template GLUT program
6 * Written by Brian Paul and in the public domain.
11 * $Log: multiwindow.c,v $
12 * Revision 1.1 2001/08/21 14:25:31 brianp
13 * simple multi-window GLUT test prog
15 * Revision 1.1.1.1 1999/08/19 00:55:42 jtg
18 * Revision 1.2 1998/11/07 14:20:14 brianp
19 * added simple rotation, animation of cube
21 * Revision 1.1 1998/11/07 14:14:37 brianp
33 static GLint Window
[2];
35 static GLfloat Xrot
= 0, Yrot
= 0, Zrot
= 0;
36 static GLboolean Anim
= GL_TRUE
;
39 static void Idle( void )
45 glutSetWindow(Window
[0]);
47 glutSetWindow(Window
[1]);
52 static void Display0( void )
54 glClear( GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
);
56 glEnable(GL_LIGHTING
);
58 glEnable(GL_DEPTH_TEST
);
61 glRotatef(Xrot
, 1, 0, 0);
62 glRotatef(Yrot
, 0, 1, 0);
63 glRotatef(Zrot
, 0, 0, 1);
74 static void Display1( void )
76 glClear( GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
);
79 glRotatef(Xrot
, 1, 0, 0);
80 glRotatef(Yrot
, 0, 1, 0);
81 glRotatef(Zrot
, 0, 0, 1);
83 glShadeModel(GL_FLAT
);
85 glBegin(GL_TRIANGLE_STRIP
);
101 static void Reshape( int width
, int height
)
103 glViewport( 0, 0, width
, height
);
104 glMatrixMode( GL_PROJECTION
);
106 glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
107 glMatrixMode( GL_MODELVIEW
);
109 glTranslatef( 0.0, 0.0, -15.0 );
113 static void Key( unsigned char key
, int x
, int y
)
115 const GLfloat step
= 3.0;
142 int main( int argc
, char *argv
[] )
144 glutInit( &argc
, argv
);
146 glutInitWindowPosition( 0, 0 );
147 glutInitWindowSize( 400, 400 );
148 glutInitDisplayMode( GLUT_RGB
| GLUT_DOUBLE
| GLUT_DEPTH
);
149 Window
[0] = glutCreateWindow(argv
[0]);
150 glutReshapeFunc( Reshape
);
151 glutKeyboardFunc( Key
);
152 glutDisplayFunc( Display0
);
154 printf("GL_RENDERER[0] = %s\n", (char *) glGetString(GL_RENDERER
));
156 glutInitWindowPosition( 500, 0 );
157 glutInitWindowSize( 400, 400 );
158 glutInitDisplayMode( GLUT_RGB
| GLUT_DOUBLE
| GLUT_DEPTH
);
159 Window
[1] = glutCreateWindow(argv
[0]);
160 glutReshapeFunc( Reshape
);
161 glutKeyboardFunc( Key
);
162 glutDisplayFunc( Display1
);
164 printf("GL_RENDERER[1] = %s\n", (char *) glGetString(GL_RENDERER
));