float Clamp(int iters_left, float t)
{
-
if (iters_left < 3) {
return 0.0;
}
{
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++) {
return 10.0 * ( (float) rand() / (float) RAND_MAX - 0.5 );
}
+#if !defined(GLUTCALLBACK)
+#define GLUTCALLBACK
+#endif
+
void GLUTCALLBACK glut_post_redisplay_p(void)
{
glutPostRedisplay();
#include <math.h>
#include <stdlib.h>
#include <GL/glut.h>
-#include "../util/readtex.c"
+#include "readtex.h"
#ifndef PI
void Idle(void)
{
- xRotation += .75;
- yRotation += .375;
+ static double t0 = -1.;
+ double t, dt;
+ t = glutGet(GLUT_ELAPSED_TIME) / 1000.;
+ if (t0 < 0.)
+ t0 = t;
+ dt = t - t0;
+ t0 = t;
+
+ xRotation += .75*60.*dt;
+ yRotation += .375*60.*dt;
glutPostRedisplay();
}
#define MAXSTARS 400
#define MAXPOS 10000
-#define MAXWARP 10
+#define MAXWARP 500
#define MAXANGLES 6000
{
float offset;
GLint n;
+ static double t0 = -1.;
+ double t, dt;
+ t = glutGet(GLUT_ELAPSED_TIME) / 1000.;
+ if (t0 < 0.)
+ t0 = t;
+ dt = 85.*(t - t0);
+ t0 = t;
offset = speed * 60.0;
stars[n].x[1] = stars[n].x[0];
stars[n].y[1] = stars[n].y[0];
stars[n].z[1] = stars[n].z[0];
- stars[n].x[0] += stars[n].offsetX;
- stars[n].y[0] += stars[n].offsetY;
- stars[n].z[0] -= offset;
- stars[n].rotation += stars[n].offsetR;
+ stars[n].x[0] += stars[n].offsetX*dt;
+ stars[n].y[0] += stars[n].offsetY*dt;
+ stars[n].z[0] -= offset*dt;
+ stars[n].rotation += stars[n].offsetR*dt;
if (stars[n].rotation > MAXANGLES) {
stars[n].rotation = 0.0;
}
return GL_TRUE;
}
+#if !defined(GLUTCALLBACK)
+#define GLUTCALLBACK
+#endif
+
void GLUTCALLBACK glut_post_redisplay_p(void)
{
glutPostRedisplay();
void Animate(void)
{
+ static double t0 = -1.;
+ double t, dt;
+ t = glutGet(GLUT_ELAPSED_TIME) / 1000.;
+ if (t0 < 0.)
+ t0 = t;
+ dt = t - t0;
+
+ if (dt < 1./60.)
+ return;
+
+ t0 = t;
switch (op) {
case OP_STRETCH:
return GL_TRUE;
}
+#if !defined(GLUTCALLBACK)
+#define GLUTCALLBACK
+#endif
+
void GLUTCALLBACK glut_post_redisplay_p(void)
{
glutPostRedisplay();
255, 127, 127, 127,
};
+#if !defined(GLUTCALLBACK)
+#define GLUTCALLBACK
+#endif
+
+
void GLUTCALLBACK glut_post_redisplay_p(void)
{
- glutPostRedisplay();
+ 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;
+
+ glutPostRedisplay();
}
static void Animate(void)