diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2004-04-22 00:47:28 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2004-04-22 00:47:28 +0000 |
commit | 2fae1bb6df99b3823a47d28ad9c63a9f994f3c9f (patch) | |
tree | 3c203613f9fa261c971024d254510afcc406537d | |
parent | 362f1df210d4142259f22d51c5269ed89dc396f3 (diff) | |
download | external_mesa3d-2fae1bb6df99b3823a47d28ad9c63a9f994f3c9f.zip external_mesa3d-2fae1bb6df99b3823a47d28ad9c63a9f994f3c9f.tar.gz external_mesa3d-2fae1bb6df99b3823a47d28ad9c63a9f994f3c9f.tar.bz2 |
minor clean-ups
-rw-r--r-- | progs/util/glutskel.c | 60 |
1 files changed, 36 insertions, 24 deletions
diff --git a/progs/util/glutskel.c b/progs/util/glutskel.c index 8c283f8..b203a50 100644 --- a/progs/util/glutskel.c +++ b/progs/util/glutskel.c @@ -1,4 +1,4 @@ -/* $Id: glutskel.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */ +/* $Id: glutskel.c,v 1.2 2004/04/22 00:47:28 brianp Exp $ */ /* * A skeleton/template GLUT program @@ -9,8 +9,11 @@ /* * $Log: glutskel.c,v $ - * Revision 1.1 1999/08/19 00:55:42 jtg - * Initial revision + * Revision 1.2 2004/04/22 00:47:28 brianp + * minor clean-ups + * + * Revision 1.1.1.1 1999/08/19 00:55:42 jtg + * Imported sources * * Revision 1.2 1998/11/07 14:20:14 brianp * added simple rotation, animation of cube @@ -31,7 +34,8 @@ static GLfloat Xrot = 0, Yrot = 0, Zrot = 0; static GLboolean Anim = GL_FALSE; -static void Idle( void ) +static void +Idle(void) { Xrot += 3.0; Yrot += 4.0; @@ -40,9 +44,10 @@ static void Idle( void ) } -static void Display( void ) +static void +Draw(void) { - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glRotatef(Xrot, 1, 0, 0); @@ -57,19 +62,21 @@ static void Display( void ) } -static void Reshape( int width, int height ) +static void +Reshape(int width, int height) { - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); + glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); + glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); + glTranslatef(0.0, 0.0, -15.0); } -static void Key( unsigned char key, int x, int y ) +static void +Key(unsigned char key, int x, int y) { const GLfloat step = 3.0; (void) x; @@ -96,7 +103,8 @@ static void Key( unsigned char key, int x, int y ) } -static void SpecialKey( int key, int x, int y ) +static void +SpecialKey(int key, int x, int y) { const GLfloat step = 3.0; (void) x; @@ -119,7 +127,8 @@ static void SpecialKey( int key, int x, int y ) } -static void Init( void ) +static void +Init(void) { /* setup lighting, etc */ glEnable(GL_DEPTH_TEST); @@ -128,17 +137,20 @@ static void Init( void ) } -int main( int argc, char *argv[] ) +int +main(int argc, char *argv[]) { - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 400, 400 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); + glutInit(&argc, argv); + glutInitWindowPosition(0, 0); + glutInitWindowSize(400, 400); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(SpecialKey); + glutDisplayFunc(Draw); + if (Anim) + glutIdleFunc(Idle); Init(); glutMainLoop(); return 0; |