Hello all,
I have a program that correctly draws an object on the screen. Now, I want to rotate the scene continuously when the user presses the enter.
else if(key==13){
while(1){
GLfloat yAxis=cam.getPos()[1];
cam.setAlpha(fmod(cam.getAlpha()+10.0,360));
cam.setPos(xComp*cos(cam.getAlpha()*DEGREE_
TO_RADIAN),yAxis,xComp*sin(cam.getAlpha()*DEGREE_TO_RADIAN));
glutPostRedisplay();
}
}
where cam is an instance of Camera class and the calculations inside are made to move the position of the camera on a circle in x-z plane.
When I replace while(1) line to for(i=0;i<5;i++), this code calculates the camera positions for 5 times and displays only the last position of the screen.
I added a Sleep function but it did not solve the problem.
How can I make it draw not only the last but also other positions of the screen.
Thanks in advance.