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

Thread: Coordinate systems

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    Lawrence, KS USA
    Posts
    6

    Coordinate systems

    I'm working on an engine that will work both in software and with OpenGL. I'm used to a left-handed coordinate system (with z going into the screen), but OpenGL uses a right-handed system, so I need to switch to that. Is there any advantage to having -z go into the screen? Since you eventually want to divide by z for perspective, doesn't this mean that you'll have to flip the sign anyway (since dividing by a negative z value would flip your x and y values)? So, I guess the question is, what are the advantages of a right-handed system?

    Thanks.

  2. #2
    Senior Member OpenGL Guru Humus's Avatar
    Join Date
    Mar 2000
    Location
    Stockholm, Sweden
    Posts
    2,345

    Re: Coordinate systems

    What is better i think i mostly of matter of taste. However, if you want z to be positive into the screen you can use glScale(1,1,-1);

  3. #3
    Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    282

    Re: Coordinate systems

    matematicians prefer the right handed system, computer graphics hobbists usually prefer a left handed system because it's more straightforward, even thought it's mainly an historical reason.

    personally i suggest a right handed system, because in computer graphics mathematics is very important, and if one want a quick reference into math texts, the step from abstraction to code is shorter.

    moreover, it's more easy to figure out rotation directions if one thinks with his hands:
    take the left hand (not the right!) and make your thumb points toward you, the index finger point up and the other finger to the right.
    just made up the right handed system coordinate frame.
    to figure out rotations, use the right hand closed with the thumb point outward.
    then, apply the right hand on top of the left hand axis: the direction of fingers of the right hand is the direction of positive rotations around that axis.
    this is also the way mathematics describe such things, like momentum.

    Dolo/\/\ightY

    [This message has been edited by dmy (edited 03-21-2000).]
    Dolo/\/\ightY

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    France
    Posts
    880

    Re: Coordinate systems

    Hi !

    Just a question : am I crazy coz' I have got my X axis going to the right of the screen, my Y axis going into the screen itself and my Z axis going to the top of the screen ???

    Huh ?

    Eric

    P.S. : I have always thought that having your Z coordinate as the altitude was more logical....

  5. #5
    Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    282

    Re: Coordinate systems

    if it works, it's good.
    when designing/rendering height fields, i too prefer that.

    Dolo/\/\ightY
    Dolo/\/\ightY

  6. #6
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    Lawrence, KS USA
    Posts
    6

    Re: Coordinate systems

    Yeah, I've read that flight and sub sims often have z going up and down, 'cuz it makes more sense to have x and y correspond to longitude and lattitude.

Posting Permissions

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