View Full Version : simple coordinate question

01-13-2004, 02:05 PM
I've had a bit of opengl experiances, but one thing I couldn't clarify.
I want to do a 2d app, which displays a square.
This square goes from -1 to 1 on both horizontal and vertical axes.
My window is 640x480, and what I need to do is display this square so that the horizontal sides are RIGHT ON the upper and lower edges of my window.

After drawing my square at -1,-1 (top left) and 1,1 (top right), how much do I have to translate the matrix on Z axis so that I get what I wanted ?

01-13-2004, 03:25 PM
just use an slightly modified identity projection, and it will work as expected :

glMatrixMode( GL_PROJECTION );
glMatrixMode( GL_MODELVIEW );

EDIT: added scale to display correctly the square

[This message has been edited by ZbuffeR (edited 01-13-2004).]

01-13-2004, 09:56 PM
use glOrtho and check out the params http://www.opengl.org/discussion_boards/ubb/smile.gif