PDA

View Full Version : Problem of Recurring function



JCheng
04-21-2010, 03:10 AM
I got the stop message of Microsoft Windows once looping with the recurring function loop as below:
================================================
void xTimer(void)
{
if (xxx==1|yyy==1){
xxx=0;yyy=0;
}
else xTimer();
}
================================================
Please advise if anything is wrong. Tks

ZbuffeR
04-21-2010, 03:21 AM
Yes, here is what is wrong : this has nothing to do with OpenGL.

What about learning about "while loop in C" thanks to any search engine ?

randall
04-21-2010, 05:49 AM
xxx==1 || yyy==1

JCheng
04-21-2010, 06:41 AM
It seems the problem doesn't fixed, even "||" is used. For more info, see part of my problem:
===============================================
GLint xxx=0,yyy=0;

void SpecialKeys(int key, int x, int y)
{
if(key == GLUT_KEY_UP|key==GLUT_KEY_F1)
xxx=1;

if(key == GLUT_KEY_DOWN|key==GLUT_KEY_F2)
yyy=1;


}

void xTimer(void)
{
if (xxx==1||yyy==1){
xxx=0;yyy=0;
}
else xTimer();
}
================================================== ==
Please advise any comment. Tks.

Aeluned
04-21-2010, 06:57 AM
Your problem seems to be one of not understanding basic programming concepts, not OpenGL.

Your recursive function has no terminating case.