Results 1 to 2 of 2

Thread: Navigating using Viewing Transformations

  1. #1
    Member Newbie
    Join Date
    Feb 2002
    Hong Kong

    Navigating using Viewing Transformations


    I am wanting to navigate a 3D scene using the keyboard.

    I use the arrow keys to translate and another couple of keys for rotation on the y-axis.

    Before I draw the scene I do the following translations:

    glRotatef(rotY, 0, 1.0f, 0);
    glTranslatef(posX, posY, posZ);

    Is this the correct order for the translations ie. rotaiton, then translation? It doesn't look right somehow.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Dec 2001
    Belmont, CA, USA

    Re: Navigating using Viewing Transformations

    Since you are actually transforming the world instead of the camera, you need to negate the x, y, z, and rotation, and do the translation and rotation in the opposite order. You should do the rotation first, then the translation. Think of it this way, if you want to move the camera toward something, you actually do it by moving the thing toward the camera. If you want to turn the camera to the left, you must rotate the world to the right.

Similar Threads

  1. Canīt apply viewing transformations to a texture!
    By wilker in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 10-10-2013, 07:14 AM
  2. Help me understand viewing transformations
    By marce in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-08-2009, 08:13 PM
  3. Viewing transformations and Coordinates
    By dvwood in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-29-2009, 06:15 PM
  4. viewing transformations help please!!!
    By in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 07-05-2000, 04:33 PM
  5. Viewing transformations in 3D
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-26-2000, 09:39 PM

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