Results 1 to 2 of 2

Thread: Edge of screen coordinates

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2005

    Edge of screen coordinates

    Hi all - very simple question here.

    I have a screen setup with
    glviewport(0, 0, self.width, self.height)
    gluPerspective(45.0, self.width/self.height, 0.1, 1000)

    I want to draw a square at the top left of the screen (at -20 into the screen). I was under the impression that this could be acheived with the following:
    Can someone please explain how the coordinate system works as you draw images further into the screen (decrease z), and how you can easily find the edge coordinates of the screen.


  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001

    Re: Edge of screen coordinates

    It works the same way as you draw a perspective drawing, object become smaller and moves to the center of the window when you move them away from the "viewer".

    You can use gluProject/gluUnproject to map between window coordinates and world coordinates.

    If you don't want the perspecive effect you can use orthographic projection instead of perspective in which case the object will not move or change size depending on Z value, but 3D objects will look a bit odd then of course.


Similar Threads

  1. Replies: 4
    Last Post: 06-08-2016, 07:01 PM
  2. marking the edge of the screen
    By zed in forum OpenGL: General
    Replies: 3
    Last Post: 03-27-2008, 01:57 AM
  3. Replies: 6
    Last Post: 05-30-2005, 01:46 PM
  4. Getting coordinates along edge of clipped planes
    By WT in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-18-2002, 11:52 PM
  5. Coordinates of an edge outline
    By nicky in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-06-2001, 05:43 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