Problems with timing in openGL
Hello, i am a beginner openGL programmer, and i have the following problem: I want to draw a triangle in the screen, keep it there for 5 seconds, make it dissapear and then draw another polygon.I use the following code:
glTranslatef(-2.5f,-4.0f,-18.0f);
static int scene=0;
static DWORD change=GetTickCount()+5000;
if (change < GetTickCount())
{
change+=5000;
scene++;
}
switch(scene)
{
case 0:{glRotatef(rquad,0.0f,0.2f,0.0f);}
case 1:{text2();glRotatef(rquad,0.0f,0.4f,0.0f);}
case 2:{text1();glRotatef(rquad,0.0f,0.6f,0.0f);}
}
the problem is that text1() appears in screen, but after 5 seconds text2() also appears,whithout text1() been cleared.
How can i make first clear text1() and then draw text2() ???
Hell World Game/3d EngineFind it at http://www.angelfire.com/on3/ironhell3index/HellWorld.html
You''re missing some breaks:
baumep
switch(scene)
{
case 0:{glRotatef(rquad,0.0f,0.2f,0.0f);}break;
case 1:{text2();glRotatef(rquad,0.0f,0.4f,0.0f);}break;
case 2:{text1();glRotatef(rquad,0.0f,0.6f,0.0f);}break;
}
baumep
baumep
thanks, this really works...But what if we want to keep the last command in case for ever? this is because EVERY thing will stay in the screen for 5 seconds.How can we say to stop this sequence and keep the last polygon drawn for ever?Maybe with another break?
Hell World Game/3d EngineFind it at http://www.angelfire.com/on3/ironhell3index/HellWorld.html
Nope u should use a default: . Instead of doing another "case #": blabal, do "default: show_scene_forever;break;"
Super Sportmatchen - A retro multiplayer competitive sports game project!
default: ??? what is ithis?this is the first time i heard about it.Can you give me some help on what that''s doing? Can i find it in one of NeHe''s tutorials?
Hell World Game/3d EngineFind it at http://www.angelfire.com/on3/ironhell3index/HellWorld.html
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement