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 10 of 10

Thread: should i convert my camera to quaternions?

Hybrid View

  1. #1
    Intern Contributor
    Join Date
    Feb 2011
    Posts
    78

    should i convert my camera to quaternions?

    i just have a regular camera class
    and i cant seem to get any correct camera angles between the world and camera view besides the z axis which is my rotation angle from left to right

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,792

    Re: should i convert my camera to quaternions?

    i just have a regular camera class
    What is a "regular camera class," and how does it differ from other camera classes that we may have used that are not "regular?"

    Or you could just explain how your camera class works.

  3. #3
    Intern Contributor
    Join Date
    Feb 2011
    Posts
    78

    Re: should i convert my camera to quaternions?

    see how this is only using a simple sin and stuff
    it makes getting angles very hard
    and i even read that is not reliable either


    void RotateView(float speed) {


    camera.view[1] = (float)(camera.pos[1] + sin(speed) * camera.vector[0] + cos(speed) * camera.vector[1]);
    camera.view[0] = (float)(camera.pos[0] + cos(speed) * camera.vector[0] - sin(speed) * camera.vector[1]);

    }

  4. #4
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,792

    Re: should i convert my camera to quaternions?

    You also need to explain what it is you want the camera to actually do that you're having trouble with.

    And USE PUNCTUATION! Periods, sentences, paragraphs. Maybe the reason you don't have a lot of "views" is because it's hard to read what you're writing.

  5. #5
    Intern Contributor
    Join Date
    Feb 2011
    Posts
    78

    Re: should i convert my camera to quaternions?

    you know that was totally a runon sentence?

    but overlooking that unintentional mishap. i believe i have already expressed the issues i am having with my camera class, which are: that i am unable to easily calculate the x rotation angle which keeps flipping values, as i can the z rotation angle that doesnt;

  6. #6
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,792

    Re: should i convert my camera to quaternions?

    that i am unable to easily calculate the x rotation angle which keeps flipping values, as i can the z rotation angle that doesnt;
    What do you mean by "the x rotation angle"? What space are you trying to rotate about the X axis? And what exactly are you rotating: the camera's position, the camera's view target, or something else entirely?

    How exactly are you trying to control the camera's position and orientation? That's the part I don't understand. You posted a few lines of code that compute two components of "camera.view", but you don't explain what "camera.view" is or how it gets used. Are these values passed to gluLookAt? Are they used by your own matrix generation code?

Posting Permissions

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