PDA

View Full Version : GLU tesselator, combine callback, advanced query



Holzschuch
01-19-2003, 11:55 PM
Hello folks,
I've been using the GLU tesselator a lot, mostly to compute the union or the intersection of several contours (I'm computing shadow contours).

I'm only working in 2D since I'm projecting all 3D vertices to a plane, I've long ago added a combine callback, I have special code to remove empty triangles, and everything is working fine, and the GLU tesselator is the nicest thing since sliced bread IMHO.

Except for a nasty little glitch.
When 2 contours intersect, the combine callback is called at the intersection, right.
If the 2 contours intersect in such a way that one vertex of the contours lies on one edge of the other contours, the combine callback is still called, good (at least, it's what I expect, since I have user data to merge at every intersection).

BUT if one vertex of one contour lies on an horizontal edge of the other contour, then the vertex is used to split the edge *without* the combine callback being called. Now, that's something I did not expect.

Let me rephrase that:

I have two intersecting contours such as:
o
|
e----o----e
|
o
where e----e is an horizontal edge (y = constant)
then the GLU tesselator somehow splits it into:
e----o plus o----e without calling combine.

If, on the other hand, I have:

e
|
|
o----o----o
|
|
e
then the combine callback is called (and, obviously, it is called for:
e
|
|
o---------o
|
|
e
)

Any hint on how to fix this behaviour will be appreciated.