Results 1 to 2 of 2

Thread: transform the world coordinate

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2001
    Posts
    25

    transform the world coordinate

    I learn that the opengl world coordinate is that x goes ritgt, y goes up and z goes to you.

    if I want to transform the world coodinates and then make object rotate and translate about the new coordinates, how do I perform this?

    thanks in advance

    Jerry

  2. #2
    Junior Member Newbie
    Join Date
    Jul 2001
    Location
    The Netherlands
    Posts
    24

    Re: transform the world coordinate

    If you want (x, y, z) to be your new origin, and (x-rot, y-rot, z-rot) your orientation, do this:

    glLoadIdentity();
    glTranslatef(x, y, z);
    glRotatef(x-rot, 1.0, 0.0, 0.0);
    glRotatef(y-rot, 0.0, 1.0, 0.0);
    glRotatef(z-rot, 0.0, 0.0, 1.0);

    glPushMatrix();

    You can then translate and rotate away from this point, and if you want to return, just pop the matrix. Don't forget to push again when you want multiple objects in your new coordinate system.

    Hope this helps

    Ritchie

Similar Threads

  1. How to convert screen coordinate to 3D world coordinate
    By happy_sweet_juice in forum OpenGL: General
    Replies: 6
    Last Post: 06-10-2017, 09:34 AM
  2. How to transform a screen coordinate to OpenGL coordinate
    By Caesirekin in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 12-11-2013, 09:29 AM
  3. Transform from window coordinate to OpenGL coordinate
    By Debugger in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-27-2007, 07:24 PM
  4. *world coordinate* vs *object coordinate*
    By ehsan2004 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 05-18-2005, 07:08 AM
  5. how to get screen coordinate from world coordinate?
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-14-2003, 12:38 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