Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: OGL camera hell

  1. #1
    Member Newbie
    Join Date
    Jul 2002
    Posts
    42

    OGL camera hell

    This is the most frustrating thing I've encountered with OpenGL. Camera control in OGL is totally unintuitive. "Camera is always at 0,0,0 looking down negative Z-axis" Who thought up that?

    If anyone has a short demo with source about moving/rotating the "camera" around could you link me? I'm getting really disenchanted with OGL's camera system. I've looked at dozens of code samples and most people wimp out and use gluLookAt().

    Everytime I try to rotate the camera around I get just the world rotating at the distinct axis X, Y, or Z.

    What I would LOVE to be able to do is take a quaternion as my orientation and set the camera too it. I've tried taking a quaternion and inverting it, but that didn't get the right rotations.

    If I can't get that I would love to be able to specify an Right, Up, Forward set of vectors that represent the camera.

    This is unbelievably frustrating. I can make all my models rotate PERFECTLY, dance, and sing--via quaternion rotations, but when it comes to moving the camera around its like trying to orient a drunken sumo.

    I'd really love any help, thanks!

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Posts
    292

    Re: OGL camera hell

    Drunken Sumo... LMAO @ JunkStyle...

    What is so wrong with gluLookAt();
    I use it and it works well so far...
    I rotate it and move forward and backwards, I could add a line of code to strafe, but I am not interested in doing it right now...

    I just uploaded an example on frustum culling that implements a camera with 6 degrees of freedom with quaternions...
    It is the third link on the right side... http://141.217.220.20/miguel/

    I hope it helps...

    [This message has been edited by mancha (edited 07-25-2002).]

  3. #3
    Member Newbie
    Join Date
    Jul 2002
    Posts
    42

    Re: OGL camera hell

    Thanks Manchu, I saw your terrain demo...pretty smooth, about 200+ fps here.

    That other demo got me going for my problem. I was actually doing the right thing but lack of confidence and stupid errors were screwing with my head....2 days down the drain.

    He had:
    GLvoid CAMERA::Apply()
    {
    Matrix.QuatToMatrix(Orientation);
    Matrix.MatrixInverse();
    glLoadMatrixf(Matrix.Element);
    glTranslatef(-Position.x,-Position.y,-Position.z);
    }

    I do pretty much the same thing but slightly different:

    1) invert my quaternion (easy since its a unit quaternion)

    2) make rotation matrix with inverted quaternion and multiply it in with the stack

    3) do translation -x, -y, -z


    She's dancing like a ballerina now.

  4. #4
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Posts
    292

    Re: OGL camera hell

    Glad I helped...

    Thanx for the comment on the terrain...

    I am working right now on a sky dome to add it to the terrain; it looks really nice... I will be making some tutorials too for the complete terrain set when I get it all done... I am pretty excited about it...

    I would like to take a look at your stuff sometime if you dont mind... I like seeing what other people do...

  5. #5
    Member Newbie
    Join Date
    Jul 2002
    Posts
    42

    Re: OGL camera hell

    yeah you, ioquan, and a bunch of others are going to get beta versions of my game + source as soon as I make it into a game. Right now its a foggy white coordinate system and a 4 triangle shaped spaceship. I'm working on the camera tracking system, which is going to be pretty weird---I hope. These last 2 weeks have been pretty intense: introduction to quaternions and OGL camera tracking. But the pain and suffering are well worth it. You don't know how great it felt when I implimented simple thruster physics to my space ship and flew it around for the first time.

  6. #6

    Re: OGL camera hell

    Originally posted by Junkstyle:
    This is the most frustrating thing I've encountered with OpenGL. Camera control in OGL is totally unintuitive. "Camera is always at 0,0,0 looking down negative Z-axis" Who thought up that?

    If anyone has a short demo with source about moving/rotating the "camera" around could you link me? I'm getting really disenchanted with OGL's camera system. I've looked at dozens of code samples and most people wimp out and use gluLookAt().

    Everytime I try to rotate the camera around I get just the world rotating at the distinct axis X, Y, or Z.

    What I would LOVE to be able to do is take a quaternion as my orientation and set the camera too it. I've tried taking a quaternion and inverting it, but that didn't get the right rotations.

    If I can't get that I would love to be able to specify an Right, Up, Forward set of vectors that represent the camera.

    This is unbelievably frustrating. I can make all my models rotate PERFECTLY, dance, and sing--via quaternion rotations, but when it comes to moving the camera around its like trying to orient a drunken sumo.

    I'd really love any help, thanks!

    camera control in OGL is intuitive. learn matrix math well .

    it's not so hard. there're camera tutorials at gametutorials.com, look into the one with a mouse on it, work on it, and you have a camera system that could move to whatever direction you want your world to be.

  7. #7
    Senior Member Regular Contributor
    Join Date
    Dec 2001
    Location
    Belmont, CA, USA
    Posts
    216

    Re: OGL camera hell

    Originally posted by Junkstyle:
    This is the most frustrating thing I've encountered with OpenGL. Camera control in OGL is totally unintuitive. "Camera is always at 0,0,0 looking down negative Z-axis" Who thought up that?
    One of the keys to OpenGL enlightenment is undertanding that OpenGL does not have a "camera system".

    If you want a camera system in OpenGL, you have to create it yourself (or use someone else's).

  8. #8
    Member Newbie
    Join Date
    Jul 2002
    Posts
    42

    Re: OGL camera hell

    There is no spoon.
    (but the little boy in the Matrix didn't have to invert a quaternion to make it bend)


    Nomad, the gametutorials.com samples all use gluLookAt().


    [This message has been edited by Junkstyle (edited 07-23-2002).]

  9. #9
    Member Contributor
    Join Date
    Sep 2001
    Location
    paris, france
    Posts
    73

    Re: OGL camera hell

    OGL camera style IS intuitive.
    Think of the Camera as your screen. The modelview matrixes leed from it to the objects.

    In your object hierarchy, lets say you have a matrix that is your camera. Absolute this matrix if its relative to another repere(s), then put the transposed matrix of this camera at the bottom of the modelview stacks (in the bottom = the first matrix that you push)

    Whats so terrific about it ?
    Oh, and lets stop afraid each other with such alien things as quaternions

  10. #10
    Guest

    Re: OGL camera hell

    Just use glrotated(angle,x,y,z) to rotate the camera and gltranslated(x,y,z) to move the camera

Page 1 of 2 12 LastLast

Similar Threads

  1. Why the hell is this If statement being ignored?
    By halo in forum OpenGL: GLSL
    Replies: 2
    Last Post: 12-28-2006, 08:42 PM
  2. matrix hell
    By mawww in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 09-29-2005, 10:58 PM
  3. Unit Hell!
    By Mighty in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-04-2004, 02:12 PM
  4. What the hell is the pbuffer?
    By Roadkill in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 09-24-2002, 02:57 PM
  5. Multitexture? What the hell for?
    By KRONOS in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 07-24-2000, 08:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean