Hi,
I’m working on a software implementation of
opengl and have a question about clipping
triangles.
from what i understand, you can perform the
clipping in clip space by comparing a point
to its w component, e.g.
-w < x < w
-w < y < w
-w < z < w
tells you the point is inside the clip space
if w is positive.
But when i have a triangle that i have
transformed by the projection matrix, the three
vertices will each have different w’s. in fact,
their w terms will be equal to the negative of
their original z.
So how do you clip the triangle against the
side of the bounding box if all the w’s are
different? which w do you use to set up the
bounding box? i don’t understand how to have
different volumes for each point. how do
you clip the edges of the triangle then?
and if you normalize, to get them all
the same, what is the point of this “clip” space
then? after all, every book on the subject
seems to indicate that clipping occurs before
the perspective divide!
thanks for your help in advance!