diff options
author | Brian Paul <[email protected]> | 2001-01-23 23:43:53 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2001-01-23 23:43:53 +0000 |
commit | 2b2e62154df4206f8340f74cb18aba4fabe4805c (patch) | |
tree | 833546c0245e7936e501fa2141fa3bc3510ab4bc /progs | |
parent | b6bcae5698df88f7730d40004ce7ce0462e97a20 (diff) |
space-bar = pause animation
Diffstat (limited to 'progs')
-rw-r--r-- | progs/demos/reflect.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/progs/demos/reflect.c b/progs/demos/reflect.c index 0d72c9d8d67..22856b542a3 100644 --- a/progs/demos/reflect.c +++ b/progs/demos/reflect.c @@ -1,4 +1,4 @@ -/* $Id: reflect.c,v 1.5 2000/12/24 22:53:54 pesco Exp $ */ +/* $Id: reflect.c,v 1.6 2001/01/23 23:43:53 brianp Exp $ */ /* * Demo of a reflective, texture-mapped surface with OpenGL. @@ -32,8 +32,8 @@ #include <stdio.h> #include <stdlib.h> #include "GL/glut.h" -#include "showbuffer.c" -#include "readtex.c" +#include "../util/showbuffer.c" +#include "../util/readtex.c" #define DEG2RAD (3.14159/180.0) @@ -53,6 +53,7 @@ static GLfloat spin; static GLint Width = 400, Height = 300; static GLenum ShowBuffer = GL_NONE; +static GLboolean Anim = GL_TRUE; /* performance info */ static GLint T0 = 0; @@ -313,6 +314,14 @@ static void draw_scene( void ) } +static void idle( void ) +{ + spin += 2.0; + yrot += 3.0; + glutPostRedisplay(); +} + + static void Key( unsigned char key, int x, int y ) { (void) x; @@ -323,6 +332,13 @@ static void Key( unsigned char key, int x, int y ) else if (key == 's') { ShowBuffer = GL_STENCIL; } + else if (key == ' ') { + Anim = !Anim; + if (Anim) + glutIdleFunc(idle); + else + glutIdleFunc(NULL); + } else if (key==27) { exit(0); } @@ -359,16 +375,6 @@ static void SpecialKey( int key, int x, int y ) } - -static void idle( void ) -{ - spin += 2.0; - yrot += 3.0; - glutPostRedisplay(); -} - - - int main( int argc, char *argv[] ) { glutInit(&argc, argv); |