View Full Version : Object corrdinates vs Window Coords IN opengl

04-18-2004, 11:14 PM

I'm trying to display a simple quad using following code in Opengl

glVertex3f(0, 0, z);
glVertex3f(1, 0, z);
glVertex3f(1, 1, z);
glVertex3f(0, 1, z);

Problem is that my quad is drawn with bottom-left corner of Quad rendered at the middle of the display window and top-right corner rendered at top-right of the window itself. Can I change the co0rdinate system so that (0,0) is taken as bottom-left of my display window ? i.e. the display window is mapped to my object as follows

(0,0) -> Bottom left of display window
(1,0) -> Bottom right of display window
(1,1) -> Top right of display window
(0,1) -> Top left of display window

-- Many Thanks

04-18-2004, 11:34 PM
You can obtain the kind of mapping you want by changing the parameters of your call to glOrtho (assuming you're using orthographic projection).
This should do the trick:
glOrtho(0.0, 1.0, 0.0, 1.0, 0.0, 1.0);