# Clipping

This topic is 3800 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hi, I have a problem to do with clipping and texture mapping, basically I have a function that applies a texture to a triangle using basic interpolation, when I perform transformations on points from world space to view space I clip them to the Z plane, for each face/triangle this can leave me with either another triangle or a quadrangle. If the result is a quadrangle I'm not sure how to split this into another two triangles to pass to the texture function. because i'm using the sutherland hodgman algorithm the result points are stored in an unordered list so I can't determine which are the shared points of the two triangles. Is there a more efficient way of doing this, or in other words how is it normally done?

##### Share on other sites
Quote:
 the result points are stored in an unordered list so I can't determine which are the shared points of the two triangles.

You can't, because there's nothing to determine. You have created two new triangles from one triangle, so you have to decide what vertex belongs to what triangle. It won't make a difference as long as you make sure that the winding order is correct.

##### Share on other sites
so, when I get this list of 4 vertices, will it just be a case of:

draw triangle list[0] list[1] list[2]
draw traingle list[0] list[3] list[2]

?

##### Share on other sites
Like I said, as long as you make sure that the vertex winding order is correct, it should work, though in your example it seems like the two triangles have different winding orders. I think the second one should be 0, 2, 3, or the first one should be 0, 2, 1, depending on what you consider to be a front facing triangle (i.e., clockwise or counter-clockwise).

thanx.

1. 1
Rutin
19
2. 2
3. 3
JoeJ
16
4. 4
5. 5

• 26
• 20
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631700
• Total Posts
3001781
×