I hope someone can help me out. I added GLU tesselation for complex polygons to my renderer,but it does not work for all cases.It works for complex non-intersecting polygons,I tried it with a VMAP0 data set - country boundaries for european states with 100k+ vertices. But once I try to tesselate this simple self-intersecting polygon:

0,0, 100,100, 0,100, 100,0

I get a complaint that the combine callback is not defined. Which is funny because this callback is called right before the error callback and it holds the correct new vertex position.

Also the begin, vertex and end callbacks are apparently not called at all...

I boiled this down into the following code, what am I doing wrong here?

Also, when you are passing the points to the gluTessVertex(GLUtessellator, data, vertexData) function first fill in a 2-D array of points say P[numPoints][3] and fill it in with the polygon vertices that you need to tessellate. If you want to add additional information about vertex colors then make another array PData[numPoints][6] and fill it in with the first 3 data members as your vertex co-ordinates (x, y, z) and the other 3 as (r, g, b) triples.

now when call gluTessVertex(tesselator, P, PData) for every point "i" in your polygon.

While not an error in the strict sense, the combine callback should not be sending vertices to OpenGL. The intention of this callback is to give you the opportunity to combine your own data structure into a new object. The last Object[] parameter is an output parameter. The idea is that you create the new object and put it in this array. An example of how you could implement it is as follows:

I don't remember for sure, but I think the reason why you may be getting an error is that the arg3 parameter contains null if you don't fill it yourself.As an aside, if your point TessPoint3D will only contain x,y,z coordinates, it is not needed. You can replace

The reason why the glu tesselator makes the distinction between the parameters is so that if for instance you have a point object that also contains a color, that you can interpolate the color as well in the combine method.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org