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

Thread: Translate without affecting perspective

  1. #1
    Intern Newbie
    Join Date
    Nov 2012
    Posts
    33

    Question Translate without affecting perspective

    Hi everyone,

    I'm putting together a simple visualization program using the fixed pipeline (I'm aware that it has been deprecated, but I need this to work on very old computers that may not have capable graphics cards).

    I'm drawing the main object of interest in the center, using a perspective projection calculated using glFrustum, and I would like to draw a set of axes in the corner.

    Problem is, I can't seem to think of a way to get it to appear using the same perspective projection (as if it were in the center) but translated to the corner. Any ideas?

    Thanks in advance.

  2. #2
    Junior Member Regular Contributor
    Join Date
    Apr 2012
    Posts
    164
    Use glViewPort to tell OpenGL that you want to draw into a small area in
    the lower left corner of the window. Then draw your axes in the center
    of that viewport.

  3. #3
    Intern Newbie
    Join Date
    Nov 2012
    Posts
    33
    Ah, I see. I should have taken a closer look at the documentation; I had assumed that glViewport specified some sort of mapping from scene coordinates to screen coordinates, but that was a mistake. I'll know not to make that sort of assumption in the future.

    Thanks for your help!

    EDIT: Just in case, I'll clarify for anybody who happens to read this: I thought glViewport mapped coordinates like glOrtho actually does.
    Last edited by Aestivae; 11-23-2012 at 07:30 PM. Reason: Clarification

Posting Permissions

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