opengldirectxtriangulationglutesselation

Is it OK to use GLUTesselator in DirectX?


Related questions: 1, 2

In my OpenGL project I use GLUTesselator to split concave polygons (which comes from external source) to triangles, which are fed to OpenGL through VBO after that. Now I'm estimating adding DirectX back-end.

I can use 3-rd party triangulator, but it's not easy to find the suitable one. There is Poly2Tri, but it works only with simple polygons, having no duplicates, no touching and so on. Otherwise it simply hangs. As my polygons comes from external source, it's not very easy to conform. GLUTesselator works perfect here; from GLU documentation: Input contours can be intersecting, self-intersecting, or degenerate. Also, polygons with multiple coincidentvertices are supported.

I think it is possible to draw polygons without holes with stencil buffer (see 4), but this provides no possibilites for caching.

As I see, it was recommended to use GLUTesselator with DirectX (see 5, 11 years ago). Is it true that GLUTesselator is pure software library? Is it OK to use it with DirectX, or there are better possibilities around?


Solution

  • The GLU Tesselator is a geometry/math only library. You can use it without initializing OpenGL, so it works fine alongside DirectX.