urquidio

01-23-2007, 03:38 PM

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? if you normalize, to get them all

the same, what is the point of this clip space

then?

thanks for your help in advance

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? if you normalize, to get them all

the same, what is the point of this clip space

then?

thanks for your help in advance