Results 1 to 4 of 4

Thread: Screen coords

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2007
    Posts
    23

    Screen coords

    Hi,

    I'm using gluUnProject to get world coordinates in my app. Let's assume that my rendering window is 100x100, i.e. the mouse position coordinates will range from 0 to 99. As OpenGL has its origin in the bottom left corner I need to do:

    mousePnt.y = winSize.y - mousePnt.y

    before using gluUnProject. But shouldn't it really be:

    mousePnt.y = winSize.y - mousePnt.y - 1

    In all tutorials and posts I've seen, people don't have the -1. Maybe I'm just a bit daft...

  2. #2
    Member Newbie
    Join Date
    Feb 2007
    Location
    Tourlaville, France
    Posts
    48

    Re: Screen coords

    Yes you need the -1 to be accurate.

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2007
    Posts
    23

    Re: Screen coords

    Hello again...

    When using gluUnProject, are the world coordinates calculated from the center of the input pixel, or the pixel corner? I guess that I will never notice any difference due to the precision, but anyway... I'm just curious.

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    990

    Re: Screen coords

    Integer coordinates correspond to pixel corners.

Similar Threads

  1. unable to translate from screen coords to world coords
    By etiennecouturie in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-28-2014, 06:04 AM
  2. Depth problem with translating screen coords to world coords
    By Bryan_dup1 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 04-13-2006, 05:02 AM
  3. NDC coords to screen coords
    By mjs1 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-02-2004, 11:58 PM
  4. Transformation of Screen coords
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 05-06-2001, 06:07 PM
  5. Screen Coords?
    By imported_Dan in forum OpenGL: Advanced Coding
    Replies: 10
    Last Post: 04-25-2000, 01:40 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