gluPerspective(50, 3./2., 1, 20);
gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);
glViewport(0,0,300,200);
double w = 300, h = 200, x = 0, y = 0;
glBegin(GL_LINE_LOOP);
glVertex3f(x+1, y+1, 0);
glVertex3f(x+1, y+h-1, 0);
glVertex3f(x+w-1, y+h-1, 0);
glVertex3f(x+w-1, y+1, 0);
glEnd();
What I get is the bottom left corner of a rectangle drawn in the top right corner of the window.
//gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);//if i use this one, it draws a rectangle
gluLookAt(0, 10, 10, 0, 0, 0, 0, 1, 0);//if i use this one, it skews the rectangle by the perspective, just as I thought it would
glViewport(0,0,300,200);
double w = 300, h = 200, x = 0, y = 0;
glBegin(GL_LINE_LOOP);
glVertex3f(-x/2+1, -y/2+1, 0);
glVertex3f(x/2-1, -y/2+1, 0);
glVertex3f(x/2-1, y/2-1, 0);
glVertex3f(-x/2+1, y/2-1, 0);
glEnd();
This does not accomplish the goal of trying to draw a rectangle around the window no matter what the perspective is. Any other suggestions?