PDA

View Full Version : as soon as specify z coordinate, line dissapears



sroy
07-02-2002, 05:14 AM
Hi,

I have the following code segment:

glBegin(GL_LINE_STRIP);

glColor3f(1.0,0.0,1.0);
glVertex3f( 400.0, 100.0,0.0);
glVertex3f(450.0,100.0,0.0);
glEnd();

Thta works fine, but as soon as I put a z-coordinate value other than 0, nothing appears on the screen.
Is it something to do with the setup?

thanks,

Sumit

Deiussum
07-02-2002, 05:30 AM
How do you setup your projection and modelview matrices? You are likely going behind the far clip plane or in front of the near clip plane.

mphanke
07-02-2002, 10:02 AM
Or your Camera is in front of the line!

Deiussum
07-02-2002, 12:20 PM
Originally posted by mphanke:
Or your Camera is in front of the line!

Well then he would also be in front of the near clip plane, now wouldn't he? http://www.opengl.org/discussion_boards/ubb/smile.gif

Anyway, just as a FYI, sroy e-mailed me some of his setup code, and I think his problem is that he is actually going outside the viewing frustum to the top right. He originally had an Orthographic view that had a left & right clip area of 0-500, and he's now trying to use a perspective view. You'll note above that his x/y coordinates are 400, 100, which would need to be pushed WAY back in order to be in a typical frustum viewing volume. Hopefully some of the code I mailed him helps explain where the viewing volume is with a perspective view.

Miguel_dup1
07-02-2002, 01:03 PM
Probably the depth test is GL_EQUAL or something...