# Thread: 3D 360 degree Panoramic Camera

1. ## 3D 360 degree Panoramic Camera

Hi guys,

I need help creating a first person camera control which can pan 360 degrees. Y is taking as the up direction. If it was birds eye view it would be an easy case of xcosa and ysina. I am using glutPassiveMouseFunc to return the mouse co-ordinates of the screen and calibrated it to take the centre point of the screen as (0,0). I know how to rotate the camera (by changing lookat point in glulookat) for a half-sphere but not the full sphere. (purely problem is the z direction) I don't mind encountering gimbal lock.

Just to emphasise the camera works, its jsut an algorithm or mathematical expression calculating the new camera points from an (x,y) co-ordinate.

2. [..]which can pan 360 degrees.
I suppose you mean rotate around Y, right?

I know how to rotate the camera (by changing lookat point in glulookat) for a half-sphere but not the full sphere.
Well, you can simply calculate the basis vectors of the camera's coordinate system. For instance, you save yourself a forward vector which is simply rotated around y and in some initial position, i.e. (0, 0, -1). If you don't want rotation about X, the problem is as simple as the 2D case you described. Simply rotate the forward vector and use that vector as input to gluLookAt. If you're camera is supposed to be mobile, you need to also save the translated eye-point, which will be given to gluLookAt as well.

If you want to break your reliance on gluLookAt at some point, check it how the function is defined. This will give you all the math you need to implement a free camera.

3. Thanks man. I actually used this exact method to solve it in the end. I needed some sleep as 12 hours of straight coding doesn't help anyone get a solution

4. I needed some sleep as 12 hours of straight coding doesn't help anyone get a solution
Nope. All it will get you in the end are herniated spinal discs.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•