View Full Version : Translate without affecting perspective

11-23-2012, 01:16 PM
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.

11-23-2012, 02:24 PM
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.

11-23-2012, 05:10 PM
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.