genghis37

06-22-2002, 10:55 AM

I read a little subsection from cg http://www.opengl.org/discussion_boards/ubb/tongue.gifrinciples and practice that discusses clipping in homogenous coordinates. In this i learned that a line segment in homogenous space might project onto the w=1 plane with a line that extends to infinity in two directions from the projected vertices. In result this should cause the graphics engine to map the line into two lines on the screen. So i thought id try this out on opengl but i only see the positive half of the line (this happens even when i swap the vertices).

Heres the snippet:

glBegin(GL_LINES);

glVertex4f(1.0, 0.0, 0.0, -3.0);

glVertex4f(1.0, 0.0, 0.0, 2.0);

glEnd();

The projection matrix is simply orthographic from (-1,-1,-1) to (1,1,1). The line should show a horizontal line extending from the left edge to -1/3 and another horizontal line extending from 1/2 to the right edge.

I thought clipping in opengl was done in homogenous space since the perspective divide is shown in diagrams to be performed afterward. I suppose the line is only clipped a single time then as opposed to being split up and clipped twice as shown in the book cg: principles and practice.

Is there a way to enable true homogenous clipping in opengl then?

Heres the snippet:

glBegin(GL_LINES);

glVertex4f(1.0, 0.0, 0.0, -3.0);

glVertex4f(1.0, 0.0, 0.0, 2.0);

glEnd();

The projection matrix is simply orthographic from (-1,-1,-1) to (1,1,1). The line should show a horizontal line extending from the left edge to -1/3 and another horizontal line extending from 1/2 to the right edge.

I thought clipping in opengl was done in homogenous space since the perspective divide is shown in diagrams to be performed afterward. I suppose the line is only clipped a single time then as opposed to being split up and clipped twice as shown in the book cg: principles and practice.

Is there a way to enable true homogenous clipping in opengl then?