nene
09-17-2003, 06:38 AM
Hi all,
I have a problem again(think should change my nick to problem_kid!!!)
Im trying to produce a animation of a object(cube) and tried to scale it to double the size and back to the normal size and back and forth. I have used a glutTimerFunc to animate it. The problem is that my object will continue to get bigger til it disappear out of my viewing area. Why doesn't it go back to the normal size.
my code :
void timer(int value)
{
glScalef(1.0,1.0,1.0);
x-= 0.1;
if (x < 0.5 )
{
x= 1.0;
}
glutPostRedisplay();
glutTimerFunc(20, timer,value);
}
//there is a glutTImerFunc in the main function.
can anyone help please?
I have a problem again(think should change my nick to problem_kid!!!)
Im trying to produce a animation of a object(cube) and tried to scale it to double the size and back to the normal size and back and forth. I have used a glutTimerFunc to animate it. The problem is that my object will continue to get bigger til it disappear out of my viewing area. Why doesn't it go back to the normal size.
my code :
void timer(int value)
{
glScalef(1.0,1.0,1.0);
x-= 0.1;
if (x < 0.5 )
{
x= 1.0;
}
glutPostRedisplay();
glutTimerFunc(20, timer,value);
}
//there is a glutTImerFunc in the main function.
can anyone help please?