View Full Version : Slow Idle callback?

10-01-2012, 09:00 PM
Hi, I'm pretty new to OpenGL. For class I have to make a table with a ball on it that tilts with the table in 3D (an example of the game is shown in http://en.wikipedia.org/wiki/Labyrinth_(game)).
To do this, in my idle callback I call an update function where I set it up so the ball tilts in the direction of the table's tilt and changes it's location based on the angle of change and time. In my program y is up, so basically I need to worry about only x and z to move the ball around on the table (assuming we ignore y and we end up looking at the table like a 2D image from the top of the table).
In the function after I change the x value based on angle change in the x direction using glm::rotate and then update the model of the ball. I try to change the z value based on the angle change in the z direction using the same function: glm::rotate and then update the model again. But, changing z after changing x causes the program to change really slowly in the z direction (change is barely noticeable) while it changes at a normal pace in the x direction. When I comment out the code for the x direction, the speed with which z changes is normal.
I don't understand why the z changes so slowly when I try to changes it after z?

I hope my explanation made sense. Thanks.