document MESA_TEX/TNL_PROG env vars
[mesa.git] / progs / demos / renormal.c
index bd099dcdc8025dd5d5aa23a709531b7c4be7908d..9e5da95484c810dabde1df372b424daf59c82e59 100644 (file)
@@ -1,15 +1,9 @@
-/* $Id: renormal.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
 
 /*
  * Test GL_EXT_rescale_normal extension
  * Brian Paul  January 1998   This program is in the public domain.
  */
 
-/*
- * $Id: renormal.c,v 1.1 1999/08/19 00:55:40 jtg Exp $
- */
-
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
 static GLfloat Phi = 0.0;
 
 
-static void Idle(void)
+static void Idle( void )
 {
-   Phi += 0.1;
+   static double t0 = -1.;
+   double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
+   if (t0 < 0.0)
+      t0 = t;
+   dt = t - t0;
+   t0 = t;
+   Phi += 3.0 * dt;
    glutPostRedisplay();
 }
 
@@ -95,10 +95,25 @@ static void ModeMenu(int entry)
    glutPostRedisplay();
 }
 
+static void
+key(unsigned char k, int x, int y)
+{
+  (void) x;
+  (void) y;
+  switch (k) {
+  case 27:  /* Escape */
+    exit(0);
+    break;
+  default:
+    return;
+  }
+  glutPostRedisplay();
+}
 
 int main( int argc, char *argv[] )
 {
    glutInit( &argc, argv );
+   glutInitWindowPosition(0, 0);
    glutInitWindowSize( 400, 400 );
 
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
@@ -110,6 +125,7 @@ int main( int argc, char *argv[] )
    glutIdleFunc( Idle );
    glutReshapeFunc( Reshape );
    glutDisplayFunc( Display );
+   glutKeyboardFunc(key);
 
    glutCreateMenu(ModeMenu);
    glutAddMenuEntry("Unscaled", UNSCALED);