05-04-2002, 07:39 AM
I'm using gluLookAt to pan a 2D image (textured). What are the units of the parameters (eyeX for example)? How can I construct a relation between these units and pixels?
There are no units in OpenGL. If you place your viewpoint at (1, 0, 0), you have placed the viewpoint one unit away from the origin along the positive X-axis. Whether this unit, in your scene, correspond to one meter, one yard, one light year, one micrometer, one inch, one foot, one astronomical unit, or three apples and a banana, is up to you to decide.
And there is no relation betwee these units and a pixel. All coordinates in OpenGL are resolution independent.
You can, of course, set the matrices, so that a unit has some relation to pixel coordinates, but that is just in your eyes, and nothing OpenGL cares about. Here's an example.
glOrtho(0.5, windowWidth + 0.5, 0.5, windowHeight + 0.5);
This piece of code will set the matrices so that you can, using for example glVertex, set a vertex in window coordinates. You then have a 1:1 correspondence between units and pixels. But that's just in your eyes. In OpenGL's eyes, these are just regular projection and modelview matrices, and are not treated special in any way.
05-04-2002, 11:19 PM
lol, Bob: an apple and a banana http://www.opengl.org/discussion_boards/ubb/smile.gif
05-05-2002, 02:43 AM
A graphics engineer I once knew used to refer to these units as a "bananas per furlong", I think he was probably closest to the true default graphics unit.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.