Advertisement

Question about openGL( change screens- wait )

Started by December 20, 2001 02:39 PM
1 comment, last by ironhell3 23 years, 2 months ago
Hello, i am a bit new to openGL.I wanted to ask how i do this: draw a polygon, rotate it for 5 seconds, clear the screen and then draw another polygon.Of course drawing and rotating is the easy part but timing and clearing the screen is the part that i don''t know...May anyone can help?
this is pretty simple. Im assuming youre using windows for this. in your drawing routine have a static DWORD called something... lets call it change. Start it off as GetTickCount() + 5000, or whatever number of seconds you want in milliseconds. Then each frame check to see if GetTickCount() is greater than change, if it is do something... pseudocode will explain better:

function DrawScene()

static int scene = 0
static DWORD change = GetTickCount() + 5000

if(change < GetTickCount()) then
change += 5000
scene++
endif

switch(scene)
case 0:
draw something
case 1:
something else
....

end DrawScene()

hope that helps... i suck at explaining things

Edited by - alargeduck on December 20, 2001 6:31:56 PM
Advertisement
ok thanks a lot..i have to try this to work...is there another way, or this is the only one?

This topic is closed to new replies.

Advertisement