From 5a6bc3d923b157a6fa88eee7a7214d3ae11720f1 Mon Sep 17 00:00:00 2001 From: Diederick Niehorster Date: Mon, 12 Mar 2012 16:33:46 +0000 Subject: [PATCH] moved glutTimerFunc in timer demo git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1121 7f0cb862-5218-0410-a997-914c9d46530a --- progs/demos/timer/timer.c | 8 ++++++-- src/freeglutdll.def | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/progs/demos/timer/timer.c b/progs/demos/timer/timer.c index d9bd89b..0f1b49f 100644 --- a/progs/demos/timer/timer.c +++ b/progs/demos/timer/timer.c @@ -31,6 +31,9 @@ int main(int argc, char **argv) glutDisplayFunc(disp); + /* get timer started, its reset in the timer function itself */ + glutTimerFunc(1000, timer_func, 0); + glutMainLoop(); return 0; } @@ -40,8 +43,6 @@ void disp(void) glClearColor(color[cidx][0], color[cidx][1], color[cidx][2], 1); glClear(GL_COLOR_BUFFER_BIT); - /* set the timer callback and ask glut to call it in 1 second */ - glutTimerFunc(1000, timer_func, 0); glutSwapBuffers(); } @@ -50,4 +51,7 @@ void timer_func(int unused) /* advance the color index and trigger a redisplay */ cidx = (cidx + 1) % (sizeof color / sizeof *color); glutPostRedisplay(); + + /* (re)set the timer callback and ask glut to call it in 1 second */ + glutTimerFunc(1000, timer_func, 0); } diff --git a/src/freeglutdll.def b/src/freeglutdll.def index a988e9a..278c1d9 100644 --- a/src/freeglutdll.def +++ b/src/freeglutdll.def @@ -144,8 +144,8 @@ EXPORTS glutInitContextFlags glutInitContextVersion glutInitContextProfile - glutInitErrorFunc - glutInitWarningFunc + glutInitErrorFunc + glutInitWarningFunc __glutInitWithExit __glutCreateWindowWithExit __glutCreateMenuWithExit -- 1.7.10.4