get rid of unused span->start field
[mesa.git] / progs / samples / olympic.c
index db72002c01a252ee97d400e4245688fea2dfe252..5385e487026f110b027e2b0541d34b336c4e3a8e 100644 (file)
@@ -26,7 +26,7 @@
  * Nov 20, 1995 use stdlib's rand()/srand() instead of random()/srand48(), etc.
  */
 
-/* 
+/*
  * Modified by Li Wei(liwei@aiar.xjtu.edu.cn) to be able to run in Windows
  * 6/13
  *
@@ -83,7 +83,7 @@ void FillTorus(float rc, int numc, float rt, int numt)
 
     pi = 3.14159265358979323846;
     twopi = 2 * pi;
+
     for (i = 0; i < numc; i++) {
        glBegin(GL_QUAD_STRIP);
         for (j = 0; j <= numt; j++) {
@@ -108,7 +108,6 @@ void FillTorus(float rc, int numc, float rt, int numt)
 
 float Clamp(int iters_left, float t)
 {
-
     if (iters_left < 3) {
        return 0.0;
     }
@@ -119,6 +118,17 @@ void DrawScene(void)
 {
     int i, j;
     GLboolean goIdle;
+    static double t0 = -1.;
+    double t, dt;
+    t = glutGet(GLUT_ELAPSED_TIME) / 1000.;
+    if (t0 < 0.)
+       t0 = t;
+    dt = t - t0;
+
+    if (dt < 1./30.)
+        return;
+
+    t0 = t;
 
     goIdle = GL_TRUE;
     for (i = 0; i < RINGS; i++) {
@@ -136,7 +146,7 @@ void DrawScene(void)
     }
 
     glPushMatrix();
-    
+
     glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
     gluLookAt(0,0,10, 0,0,0, 0,1,0);
 
@@ -167,6 +177,10 @@ float MyRand(void)
    return 10.0 * ( (float) rand() / (float) RAND_MAX - 0.5 );
 }
 
+#if !defined(GLUTCALLBACK)
+#define GLUTCALLBACK
+#endif
+
 void GLUTCALLBACK glut_post_redisplay_p(void)
 {
       glutPostRedisplay();
@@ -252,7 +266,7 @@ void Init(void)
     dests[GREENRING][1] = bottom_y;
     dests[GREENRING][2] = bottom_z;
 
-    base = 2.0; 
+    base = 2.0;
     height = 2.0;
     theTorus = glGenLists(1);
     glNewList(theTorus, GL_COMPILE);
@@ -321,7 +335,7 @@ GLenum Args(int argc, char **argv)
     GLint i;
 
     rgb = GL_TRUE;
-    doubleBuffer = GL_FALSE;
+    doubleBuffer = GL_TRUE;
 
     for (i = 1; i < argc; i++) {
        if (strcmp(argv[i], "-ci") == 0) {