Camera watching the Origin from any place


well, first to let you know, i nearly don’t know anything about OpenGL. But I think knowing something about Vectors is useful, isn’t it???

I want to use a Camera watching the Origin from a defined position on a sphere of a defined radius.
I thought this might be solved with gluLookAt.
The Point on the sphere is defined by to angles.
One specifies from where you look if you are on the ground (alpha) and the other defines how far you are away from the ground (beta). The radius of the sphere is the variable zoom

gluLookAt(cos(alpha)*zoom, -tan(beta)*zoom,sin(alpha)*zoom, 0,0,0 ,0,1,0);

0,0,0 is for the origin!

0,1,0 means that i am standing on the ground???

No, the last triplette defines the up vector of your camera. Suppose you have a pyramid, pointing upwards. With (0, 1, 0) you “hold” the camera correctly, so you see the pyramid pointing upwards. With (0, -1, 0) you would see the pyramid pointing downwards. Be carefull: the pyramid will always be pointing upwards. It’s how you position the camera that will effect the way you view the pyramid. Another example:
(1, 0, 0) and the pyramid would be pointing to the left because you’re holding the camera sideways.
Hope I’ve made myself clear. Good luck
PS If you haven’t done so, check out spherical (or polar) coordinates

Well, so I’ll need an Orthogonal referring to my View-Direction???

Sorry for my bad English

Hi Gast,

Perhaps a picture will help clarify a few things (they always help me).

But I think knowing something about Vectors is useful, isn’t it???

It most certainly is :slight_smile: