1 /* $Id: glutskel.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
4 * A skeleton/template GLUT program
6 * Written by Brian Paul and in the public domain.
11 * $Log: glutskel.c,v $
12 * Revision 1.1 1999/08/19 00:55:42 jtg
15 * Revision 1.2 1998/11/07 14:20:14 brianp
16 * added simple rotation, animation of cube
18 * Revision 1.1 1998/11/07 14:14:37 brianp
30 static GLfloat Xrot
= 0, Yrot
= 0, Zrot
= 0;
31 static GLboolean Anim
= GL_FALSE
;
34 static void Idle( void )
43 static void Display( void )
45 glClear( GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
);
48 glRotatef(Xrot
, 1, 0, 0);
49 glRotatef(Yrot
, 0, 1, 0);
50 glRotatef(Zrot
, 0, 0, 1);
60 static void Reshape( int width
, int height
)
62 glViewport( 0, 0, width
, height
);
63 glMatrixMode( GL_PROJECTION
);
65 glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
66 glMatrixMode( GL_MODELVIEW
);
68 glTranslatef( 0.0, 0.0, -15.0 );
72 static void Key( unsigned char key
, int x
, int y
)
74 const GLfloat step
= 3.0;
99 static void SpecialKey( int key
, int x
, int y
)
101 const GLfloat step
= 3.0;
122 static void Init( void )
124 /* setup lighting, etc */
125 glEnable(GL_DEPTH_TEST
);
126 glEnable(GL_LIGHTING
);
131 int main( int argc
, char *argv
[] )
133 glutInit( &argc
, argv
);
134 glutInitWindowPosition( 0, 0 );
135 glutInitWindowSize( 400, 400 );
136 glutInitDisplayMode( GLUT_RGB
| GLUT_DOUBLE
| GLUT_DEPTH
);
137 glutCreateWindow(argv
[0]);
138 glutReshapeFunc( Reshape
);
139 glutKeyboardFunc( Key
);
140 glutSpecialFunc( SpecialKey
);
141 glutDisplayFunc( Display
);