I’m writing a program with a big blob that can be deformed in a variety of ways, so I’m using the tessellation features available in GLU. I’m new to this, so I’m really just trying to get the code from this tutorial to work.
Simply looping through the vertices of the blob and calling gluTessVertex on each one seems to work fine in most cases, but there seem to be two situations where it doesn’t. The first is if the edges of the blob ever intersect each other (similarly, the second example from the code linked, the star with intersecting edges, isn’t working for me).
The second, which is stranger to me because it doesn’t strike me as though anything particularly “weird” is going on, is when I pull out one vertex of the blob too far. If I remove the “System.exit(0)” call in the error callback linked above, the program keeps running (although it of course won’t render the tessellation), but I’m also drawing an outline of the blob with lines, so I can tell that the only thing that appears to trigger this error is if the angle between the two vertices is too small. Like, for three vertices in the outside of the blob, aligned like this: V . If the “lines” there get too close together (not even so close that the empty space appears to disappear), an error gets triggered and the tessellation doesn’t draw.
In both cases, it returns an “out of memory” error. I don’t know much about different kinds of errors in OpenGL, but it seems unlikely that it’s actually running out of memory (given that even the 5-vertex self-intersecting star in the example won’t render for me). I’ve been looking through the documentation trying to figure out what’s going wrong, but nothing obvious is standing out to me and I don’t understand OpenGL or tessellation on a deep enough level to figure it out any other way.
To give an example, here are two screenshots of my program side-by-side:
http://img139.imageshack.us/img139/9948/tessellationerrorpn1.gif
The one on the left is fine, but with one on the right the angle at the tip is too small, or it’s too “sharp,” or however that might be described because it’s the only difference (these screenshots were taken a few seconds apart), and it throws an error so no tessellation renders (of course, the outline drawn with lines still renders perfectly, so I know what it should look like).
And then of course any self-intersections in the blob at all, or even the 5-vertex star from the tutorial, also throw the same error and won’t render.