opengl - glutPostRedisplay not working inside a loop -
opengl - glutPostRedisplay not working inside a loop -
i trying create man jump on y axis, utilize loop of 2 seconds, first sec should move downwards , bend knees, , sec second should move , finish in starting position. right starting create man go downwards , bend it's knees in first second, haven't programmed rest of animation. problem glutpostredisplay not refreshing screen within loop needed looks animation, re displays screen after loop has completed. how glutpostredisplay refresh screen within loop looks animation?
case ' ': miliseconds = 0; movemany = 0; start = clock(); i=0; while (miliseconds<2000) { finish = clock(); miliseconds = (finish - start); sleep(1); if (miliseconds<1000) { movemany=movemany-0.02; } glutpostredisplay(); } break;
glutpostredisplay
not straight trigger redrawing screen. indicates scheme screen needs redrawing possible. calling multiple times in loop, do, has same effect calling once. see here more details.
i cannot tell code posted called from. however, want utilize glutidlefunc
designate method called when there's nil else and, in it, need single frame of animation , phone call glutpostredisplay
once. require move timer somewhere else.
i found this tutorial helpful glut animations.
opengl
Comments
Post a Comment