X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=progs%2Fdemos%2FFractals%2Ffractals.c;h=9bb3bfe2cc86d4eefa72d0b741f7906f496522a1;hb=b620b93fa08b74c496127c1734a115964d040fed;hp=e015eb234532b996800334f5c9e956710b39756c;hpb=b002d4d62a9591e15a8fc58d4043f103ce5d51de;p=freeglut diff --git a/progs/demos/Fractals/fractals.c b/progs/demos/Fractals/fractals.c index e015eb2..9bb3bfe 100644 --- a/progs/demos/Fractals/fractals.c +++ b/progs/demos/Fractals/fractals.c @@ -21,6 +21,7 @@ #include #include #include +#include #include typedef struct @@ -120,6 +121,8 @@ Reshape(int width, int height) static void Key(unsigned char key, int x, int y) { + int need_redisplay = 1; + switch (key) { case 27: /* Escape key */ glutLeaveMainLoop () ; @@ -140,16 +143,21 @@ Key(unsigned char key, int x, int y) xwin = -1.0 ; ywin = 0.0 ; glTranslated ( xwin, ywin, -5.0 ) ; - break ; - } - glutPostRedisplay(); + default: + need_redisplay = 0; + break; + } + if (need_redisplay) + glutPostRedisplay(); } static void Special(int key, int x, int y) { + int need_redisplay = 1; + switch (key) { case GLUT_KEY_UP : glMatrixMode ( GL_MODELVIEW ) ; @@ -190,9 +198,13 @@ Special(int key, int x, int y) glTranslated ( xwin, ywin, 0.0 ) ; scale_factor *= 1.25 ; break ; - } - glutPostRedisplay(); + default: + need_redisplay = 0; + break; + } + if (need_redisplay) + glutPostRedisplay(); }