Talk:OpenGL Programming/Modern OpenGL Tutorial Arcball

= Bug =

In some rare cases, the rotated object disappears. I suspect a float precision issue causing the Matrix to get NaN values, similar to the one that made me clamp angle: float angle = acos(min(1.0f, glm::dot(va, vb)));

If you find it, please fix :) Beuc (discuss • contribs) 09:07, 9 October 2011 (UTC)

Which data to apply in the Pythagore Theorem in order to compute z ? And is the ball centered around origin assumption has been made ?
It is said in this article to apply Pythagore theorem in order to compute z value :

$$\scriptstyle b \;=\; \sqrt{c^2 \,-\, a^2}. \,$$

I easily understand that c stands for z value, but what values must be applied to c and a in the Pythagore formula ?

I would also need to know if the assumption that the ball is centered around OpenGL origin has been made.

Thanks in advance

Loloof64 (discuss • contribs) 12:32, 9 October 2011 (UTC)


 * Hi,
 * In the formula, a is the click position along X in the Projection, b is the z coordinate, and c is the ball's radius.
 * The ball is "pressed" on the screen, and its radius is 1, so its center is located at (0,0,-1) is View space (not sure what you call OpenGL origin).
 * Does that make more sense? :) Beuc (discuss • contribs) 13:21, 9 October 2011 (UTC)


 * Hi
 * Thank you, now I've well understood for the formula.
 * In fact, for the ball origin, it is possible to have the Ball centered at the origin if you set the camera location away from the origin (with GLU gluLookAt), that's why I asked you that question.
 * Thank you very much
 * Loloof64 (discuss • contribs) 16:56, 9 October 2011 (UTC)