*/
public static void _renderShape(Shape s, int resolution) {
PathIterator pi = s.getPathIterator(null);
Point2D.Float current = new Point2D.Float();
_beginTesselator();
GLUtessellator tess = _tess;
tess.gluTessBeginPolygon(null);
switch (pi.getWindingRule()) {
case PathIterator.WIND_EVEN_ODD:
tess.gluTessProperty(GLU.GLU_TESS_WINDING_RULE, GLU.GLU_TESS_WINDING_ODD);
break;
case PathIterator.WIND_NON_ZERO:
tess.gluTessProperty(GLU.GLU_TESS_WINDING_RULE, GLU.GLU_TESS_WINDING_NONZERO);
break;
default:
if (JXAenvUtils._debug) {
System.err.println(JXAenvUtils.log("no winding rule", JXAenvUtils.LVL.APP_WRN));
}
break;
}
while (!pi.isDone()) {
float[] coords = new float[6];
int path = pi.currentSegment(coords);
switch (path) {
case PathIterator.SEG_MOVETO:
/*
* if (JXAenvUtils._debug) { System.err.println(">>> GL TESS
* >>> begin move"); }
*/
tess.gluTessBeginContour();
tess.gluTessVertex(new double[]{coords[0], coords[1], 0.}, 0, new float[]{coords[0], coords[1], 0f});
current.x = coords[0];
current.y = coords[1];
break;
case PathIterator.SEG_CLOSE:
/*
* if (JXAenvUtils._debug) { System.err.println(">>> GL TESS
* >>> close"); }
*/
tess.gluTessEndContour();
break;
case PathIterator.SEG_LINETO:
/*
* if (JXAenvUtils._debug) { System.err.println(">>> GL TESS
* >>> line"); }
*/
tess.gluTessVertex(new double[]{coords[0], coords[1], 0.}, 0, new float[]{coords[0], coords[1], 0f});
current.x = coords[0];
current.y = coords[1];
break;
case PathIterator.SEG_CUBICTO:
/*
* if (JXAenvUtils._debug) { System.err.println(">>> GL TESS
* >>> cubic"); }
*/
for (Point2D.Float p : GLGeom._computeBezierCurve(new Point2D.Float[]{current, new Point2D.Float(coords[0], coords[1]), new Point.Float(coords[2], coords[3]), new Point.Float(coords[4], coords[5])}, resolution)) {
tess.gluTessVertex(new double[]{p.x, p.y, 0.}, 0, new float[]{p.x, p.y, 0f});
}
current.x = coords[4];
current.y = coords[5];
break;
case PathIterator.SEG_QUADTO:
/*
* if (JXAenvUtils._debug) { System.err.println(">>> GL TESS
* >>> quad"); }
*/
for (Point2D.Float p : GLGeom._computeBezierCurve(new Point2D.Float[]{current, new Point2D.Float(coords[0], coords[1]), new Point.Float(coords[2], coords[3])}, resolution)) {
tess.gluTessVertex(new double[]{p.x, p.y, 0.}, 0, new float[]{p.x, p.y, 0f});
}
current.x = coords[2];
current.y = coords[3];
break;
default:
break;
}
pi.next();
}
tess.gluTessEndPolygon();
_endTesselator();
}