 # how do I calculate correct angles to an object ?

My problem is,
I`ve got some hemispheres and in order to rotate them correct I need to calculate the x, y and z angle from my viewpoint to the object, so that I`m able to rotate the hemisphere according to these angles. I already know how to get the correct distance and the relative coordinates from viewp. to object, but if I rotate the sphere these angles should change. I know I´ve got to use the modelview matrix, but not how.
Thanks…

If I understand your problem correctly all that is needed is a little bit of trig. There may be a better way to do what you want but the following way should work.

ASSUMING the camera is at the origin and
x, y, and z are the distance to object in the respective direction

theta.x = arctan(z/y)
theta.y = arctan(z/x)
theta.z = arctan(x/y)

Hope that helps.

hhmmmm, when i try to use the arctan() function, the compiler cant find it, and i cant find the funtion in any help files, what do i have to include to use that function?

hhmmmm, when i try to use the arctan() function, the compiler cant find it, and i cant find the funtion in any help files, what do i have to include to use that function?

you have to include math.h.

but the syntax is atan. arctan is the french symbol.