Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: 3D 360 degree Panoramic Camera

  1. #1
    Newbie Newbie
    Join Date
    Aug 2012
    Posts
    3

    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.

    Thanks for any help you can other guys

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    892
    [..]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. #3
    Newbie Newbie
    Join Date
    Aug 2012
    Posts
    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. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    892
    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
  •