summaryrefslogtreecommitdiffstats
path: root/progs/demos/pointblast.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-01-09 17:37:50 +0000
committerBrian Paul <[email protected]>2005-01-09 17:37:50 +0000
commit92eddb0fd404624ca198f19e4088927701eec7f5 (patch)
treedd93d51d271e6bd43d09af9e8b0f3a98a640a8d2 /progs/demos/pointblast.c
parent516f9bc6e306fe7820649ead125d557b46ca8419 (diff)
better animate rate (Marcelo Magallon)
Diffstat (limited to 'progs/demos/pointblast.c')
-rw-r--r--progs/demos/pointblast.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/progs/demos/pointblast.c b/progs/demos/pointblast.c
index 14e9cf359fb..715813f1763 100644
--- a/progs/demos/pointblast.c
+++ b/progs/demos/pointblast.c
@@ -79,7 +79,6 @@ static float float_rand(void) { return rand() / (float) RAND_MAX; }
#define MEAN_VELOCITY 3.0
#define GRAVITY 2.0
-#define TIME_DELTA 0.025 /* The speed of time. */
/* Modeling units of ground extent in each X and Z direction. */
#define EDGE 12
@@ -114,6 +113,13 @@ updatePointList(void)
float distance;
int i;
+ static double t0 = -1.;
+ double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
+ if (t0 < 0.0)
+ t0 = t;
+ dt = t - t0;
+ t0 = t;
+
motion = 0;
for (i=0; i<numPoints; i++) {
distance = pointVelocity[i][0] * theTime;
@@ -139,9 +145,9 @@ updatePointList(void)
pointTime[i] = 0.0; /* Reset the particles sense of up time. */
}
motion = 1;
- pointTime[i] += TIME_DELTA;
+ pointTime[i] += dt;
}
- theTime += TIME_DELTA;
+ theTime += dt;
if (!motion && !spin) {
if (repeat) {
makePointList();
@@ -264,7 +270,7 @@ menu(int option)
case 0:
makePointList();
break;
-#if GL_ARB_point_parameters
+#ifdef GL_ARB_point_parameters
case 1:
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, constant);
break;
@@ -281,7 +287,7 @@ menu(int option)
case 5:
blend = 0;
break;
-#if GL_ARB_point_parameters
+#ifdef GL_ARB_point_parameters
case 6:
glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 1.0);
break;