PDA

View Full Version : Converting window to display coordinate



08-15-2003, 05:46 PM
I need to convert a line with points (29,215) and (355,68) so that it will be display correctly in my viewport. I'm very new to OpenGL so can somebody help me with this? The setup of my viewport is as followed:

glViewport(0,0,ww,wh);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//gluOrtho2D(0.,(GLdouble)ww,0.,(GLdouble)wh);
gluOrtho2D(0.0,1.0,0.0,1.0);
glMatrixMode(GL_MODELVIEW);

mikael_aronsson
08-15-2003, 10:20 PM
Hi !

If you mean that you want the line to look as it would if you draw it in 2D mapped to the pixel coordinate system then you should have a look at the FAQ on this website, it explains how to setup your projection like that.

Mikael