diff options
author | Brian Paul <[email protected]> | 2000-03-22 18:38:47 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2000-03-22 18:38:47 +0000 |
commit | d21cdb6d84c75b56b482d605f4848aa4912e89e3 (patch) | |
tree | ccc7f652aca216752b89a542250d5c46230b21d5 /progs/demos | |
parent | 29d39d52a0ac1b21f593ccb8ae3e3452f342257f (diff) |
tweaked the animation rate
Diffstat (limited to 'progs/demos')
-rw-r--r-- | progs/demos/lodbias.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/progs/demos/lodbias.c b/progs/demos/lodbias.c index e36acc67cdf..1d01502d97d 100644 --- a/progs/demos/lodbias.c +++ b/progs/demos/lodbias.c @@ -39,8 +39,8 @@ static GLfloat Xrot = 0, Yrot = -30, Zrot = 0; static GLboolean Anim = GL_TRUE; -static GLint Bias = 0, DeltaBias = 10; /* ints avoid fp precision problem */ -static GLint BiasMin = -200, BiasMax = 300; +static GLint Bias = 0, BiasStepSign = +1; /* ints avoid fp precision problem */ +static GLint BiasMin = -200, BiasMax = 500; @@ -55,14 +55,26 @@ PrintString(const char *s) static void Idle( void ) { - Bias += DeltaBias; + static int lastTime = 0; + int time = glutGet(GLUT_ELAPSED_TIME); + int step; + + if (lastTime == 0) + lastTime = time; + else if (time - lastTime < 10) + return; + + step = (time - lastTime) / 10 * BiasStepSign; + lastTime = time; + + Bias += step; if (Bias < BiasMin) { Bias = BiasMin; - DeltaBias = 10; + BiasStepSign = +1; } else if (Bias > BiasMax) { Bias = BiasMax; - DeltaBias = -10; + BiasStepSign = -1; } glutPostRedisplay(); |