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

Thread: how to change coordinate system to screen coordinates (0,0 at UpperLeft) ?

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2003
    Posts
    26

    how to change coordinate system to screen coordinates (0,0 at UpperLeft) ?

    Hello,
    I tried to modify the modelview matrix by multiplying it by a modified identity matrix (y coord was -1 instead of 1 to inverse y coordinates) and then translating it by vector 0,480 (my screen height=480), but that didn't work too well. Could someone share his/her experience regarding this problem ? I just want to be able to specify coordinates where left,top is 0,0, and y coordinates grow towards bottom, not up, as the default is (for GUI application).
    Thank you for your help,

    Martin

  2. #2
    Junior Member Newbie
    Join Date
    Jan 2003
    Location
    Melbourne, Victoria, Australia
    Posts
    13

    Re: how to change coordinate system to screen coordinates (0,0 at UpperLeft) ?

    The idea you came up with seems a good one. Perhaps specifying a view frustrum inveretd along the y-axis would do the trick. For instace, you could try glOrtho(-5, 5, 5, -5, -5, 5).

    Any particular reason why you want to do this?
    ---------------------------
    "I'm ready to get busy!"
    Anonymous - Boondock Saints

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2003
    Posts
    26

    Re: how to change coordinate system to screen coordinates (0,0 at UpperLeft) ?

    Hello,
    Thank you for your reply. I wanted to change the coordinate context because I want to write a 2D app and I wanted to create visual components (like those in Java), where you specify the top left corner as origin and width,height of the component. I thought it would be easier to modify the view matrix instead of keeping the default opengl coordinates and thinking 'ok, I want to draw a rectangle at 10,10, so I really have to draw a rectangle at 10,screenHeight-10'.
    Thank you for your help,

    Martin

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2003
    Posts
    26

    Re: how to change coordinate system to screen coordinates (0,0 at UpperLeft) ?

    I forgot to ask - I'm using bitmapped fonts where coordinates are specified by rasterPos2f(). Would those transformations affect the font position too ? I think there might be a problem with inverting bitmapped font - they are always positioned the same, if I'm not mistaken.

Posting Permissions

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