public virtual void gluTessEndPolygon() { GLUmesh mesh; try { requireState(TessState.T_IN_POLYGON); state = TessState.T_DORMANT; if (this.mesh == null) { if (!flagBoundary) { /* Try some special code to make the easy cases go quickly * (eg. convex polygons). This code does NOT handle multiple contours, * intersections, edge flags, and of course it does not generate * an explicit mesh either. */ if (Render.__gl_renderCache(this)) { polygonData = null; return; } } if (!flushCache()) { throw new System.SystemException(); /* could've used a label*/ } } /* Determine the polygon normal and project vertices onto the plane * of the polygon. */ Normal.__gl_projectPolygon(this); /* __gl_computeInterior( tess ) computes the planar arrangement specified * by the given contours, and further subdivides this arrangement * into regions. Each region is marked "inside" if it belongs * to the polygon, according to the rule given by windingRule. * Each interior region is guaranteed be monotone. */ if (!Sweep.__gl_computeInterior(this)) { throw new System.SystemException(); /* could've used a label */ } mesh = this.mesh; if (!fatalError) { bool rc = true; /* If the user wants only the boundary contours, we throw away all edges * except those which separate the interior from the exterior. * Otherwise we tessellate all the regions marked "inside". */ if (boundaryOnly) { rc = TessMono.__gl_meshSetWindingNumber(mesh, 1, true); } else { rc = TessMono.__gl_meshTessellateInterior(mesh); } if (!rc) { throw new System.SystemException(); /* could've used a label */ } Mesh.__gl_meshCheckMesh(mesh); if (callBegin != NULL_CB || callEnd != NULL_CB || callVertex != NULL_CB || callEdgeFlag != NULL_CB || callBeginData != NULL_CB || callEndData != NULL_CB || callVertexData != NULL_CB || callEdgeFlagData != NULL_CB) { if (boundaryOnly) { Render.__gl_renderBoundary(this, mesh); /* output boundary contours */ } else { Render.__gl_renderMesh(this, mesh); /* output strips and fans */ } } // if (callMesh != NULL_CB) { // ///* Throw away the exterior faces, so that all faces are interior. // * This way the user doesn't have to check the "inside" flag, // * and we don't need to even reveal its existence. It also leaves // * the freedom for an implementation to not generate the exterior // * faces in the first place. // */ // TessMono.__gl_meshDiscardExterior(mesh); // callMesh.mesh(mesh); /* user wants the mesh itself */ // mesh = null; // polygonData = null; // return; // } } Mesh.__gl_meshDeleteMesh(mesh); polygonData = null; mesh = null; } catch (System.Exception e) { SupportClass.WriteStackTrace(e, Console.Error); callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY); } }