I read a little subsection from cg:principles 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:
glVertex4f(1.0, 0.0, 0.0, -3.0);
glVertex4f(1.0, 0.0, 0.0, 2.0);
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?
Okay, nobody seems too interested but i think ive found an acceptable solution. Respecify all primitives with w's that have different signs and reverse the sign of all their components before respecifying them. For primitives with vertices that are all neg w components, specify them once but reverse all the components signs before specification. This works for lines at least.