summaryrefslogtreecommitdiffstats
path: root/progs/demos/gloss.c
diff options
context:
space:
mode:
Diffstat (limited to 'progs/demos/gloss.c')
-rw-r--r--progs/demos/gloss.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/progs/demos/gloss.c b/progs/demos/gloss.c
index e7d687508c2..4e7adc8d48f 100644
--- a/progs/demos/gloss.c
+++ b/progs/demos/gloss.c
@@ -21,9 +21,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
+#include <string.h>
#include <GL/glut.h>
-#include "readtex.c" /* I know, this is a hack. */
+#include "readtex.h"
#define SPECULAR_TEXTURE_FILE "../images/reflect.rgb"
#define BASE_TEXTURE_FILE "../images/tile.rgb"
@@ -43,7 +44,7 @@ static GLuint Object = 0;
static GLboolean Animate = GL_TRUE;
static GLfloat Xrot = 0.0, Yrot = 0.0, Zrot = 0.0;
-static GLfloat DXrot = 1.0, DYrot = 2.5;
+static GLfloat DXrot = 20.0, DYrot = 50.;
static GLfloat Black[4] = { 0, 0, 0, 0 };
static GLfloat White[4] = { 1, 1, 1, 1 };
@@ -58,13 +59,18 @@ static GLint T0 = 0;
static GLint Frames = 0;
-
-
static void Idle( void )
{
+ static double t0 = -1.;
+ double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
+ if (t0 < 0.0)
+ t0 = t;
+ dt = t - t0;
+ t0 = t;
+
if (Animate) {
- Xrot += DXrot;
- Yrot += DYrot;
+ Xrot += DXrot*dt;
+ Yrot += DYrot*dt;
glutPostRedisplay();
}
}