c++ - Playing an animation in OpenGL -


just want put delay of few microsec can see animations. delay function not working. using fltk can help.

for(i = 0; < 1; = + 0.1) {      glclearcolor(0.0f, 0.0f, 0.0f, 1.0f );     glclear(gl_color_buffer_bit | gl_depth_buffer_bit);      glloadidentity();     gltranslatef(i,i,1);     glrotatef(spin, 0, 0, 1);     delay(1000);     glscalef(i,i,i);     glutwirecube(1);         } 

you don't play animations way in opengl (well technically put swapbuffers @ end of loop, that's not idea).

what should implementing idle handler, issues redraw when called. in drawing function should time time between calls display function advance animation amount.

never(!) run loop in add sleep or similar. such code not responsive outside events, , modern os consider programs behaving nonresponsive/hung , show user message box allows killing program. not want.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -