11-04-2003, 03:51 AM

Hi,

I would like to display an horizontal line in the middle of a window of size (cx, cy) with OpenGL. I wish that my line be to entirely post and that it is largest possible. How to know the coordinates of the tops of my rectangle so that this one is posted correctly???

For the moment, I do that:

glViewport(0, 0, cx, cy);

glMatrixMode(GL_PROJECTION);

glLoadIdentity();

gluPerspective(45, (float)cx/(float) cy, 0, 1000);

gluLookAt(0,0,-10,0,0,0,0,1,0);

glBegin(GL_LINES);

glVertex3f(X1,Y1,Z1);

glVertex3f(X2,Y2,Z2);

glEnd

I want find the values of X1, Y1, Z1, X2, Y2, Z2...

Do somebody know how to solve my problem??

Solen

I would like to display an horizontal line in the middle of a window of size (cx, cy) with OpenGL. I wish that my line be to entirely post and that it is largest possible. How to know the coordinates of the tops of my rectangle so that this one is posted correctly???

For the moment, I do that:

glViewport(0, 0, cx, cy);

glMatrixMode(GL_PROJECTION);

glLoadIdentity();

gluPerspective(45, (float)cx/(float) cy, 0, 1000);

gluLookAt(0,0,-10,0,0,0,0,1,0);

glBegin(GL_LINES);

glVertex3f(X1,Y1,Z1);

glVertex3f(X2,Y2,Z2);

glEnd

I want find the values of X1, Y1, Z1, X2, Y2, Z2...

Do somebody know how to solve my problem??

Solen