If you are doing only a translate to the sphere, then then x,y,z location is now the center of the sphere.
If I have a sphere it center 0,0,0 and I translate it 5, 0, 0.
Then its new center is 5,0,0 and I base this on the fact the each time we update the sphere location we do a glLoadMatrix() call at the start of the display() routine.
If we do not reset the matrix each time then the Translate becomes additive, take the example of translate 5,0,0.
First pass through display(): 5,0,0
Second pass: 10,0,0
Third pass: 15,0,0
etc.
Look at my clock example on my website, object motion and animation example:
http://www.angelfire.com/linux/nexusone/index.html
Originally posted by remedios79:
[b]I’m using three variables x, y, z, every time I enter the motion function I add new quantity to these variables, and then I apply only one glTranslate inside the DisplayFunction.
I’d like to know how to make the sphere moving as if it was “attached” to the mouse… but this is another problem.
I need to know the coordinates of the sphere center in the world system, and I have x,y,z .
How can I extract the coordinates?
Thank you[/b]