Find Coordinates

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

hi solen,
just to check if i understood clearly what u are asking: what u want to know is how large your frustum of view is at z=0? In other words you want that your line is exactly large as the screen is, right?
Bye the Gunslinger

Yes that’s it!

Furthermore, I know that Z1=Z2=constant!
Do you know a solution to my problem?

hi mimi, sorry for the delay in the answer, i hope it isn’t too late.
Even if i am not able to give you the right expressions to solve your problems, i can give u a hint that may help you. On the site www.gametutorials.com there are a couple of tutorials using the frustum culling tecnique. In those tutorials u may find the expressions of the screen frustum plane equations. Once u have em, well u just have to find where your line “hits” the frustum and voila, problem solved. Hope it will help…
bye The Gunslinger