use of com.jogamp.opengl.glu.GLUtessellator in project narchy by automenta.
the class Polygon3D method addToObject.
/**
* Add polygon to an object
*
* @param object3D
* Object where add
* @param glu
* OpenGL utilities
*/
void addToObject(final Object3D object3D, final GLU glu) {
this.object3D = object3D;
this.object3D.nextFace();
final GLUtessellator tessellator = glu.gluNewTess();
glu.gluTessCallback(tessellator, GLU.GLU_TESS_BEGIN, this);
glu.gluTessCallback(tessellator, GLU.GLU_TESS_COMBINE, this);
glu.gluTessCallback(tessellator, GLU.GLU_TESS_ERROR, this);
glu.gluTessCallback(tessellator, GLU.GLU_TESS_VERTEX, this);
glu.gluTessProperty(tessellator, GLU.GLU_TESS_WINDING_RULE, this.windingRule);
glu.gluTessBeginPolygon(tessellator, null);
glu.gluTessBeginContour(tessellator);
final double[] point = new double[3];
for (final Vertex vertex : this.polygon) {
point[0] = vertex.getPosition().x;
point[1] = vertex.getPosition().y;
point[2] = vertex.getPosition().z;
glu.gluTessVertex(tessellator, point, 0, vertex);
}
glu.gluTessEndContour(tessellator);
glu.gluTessEndPolygon(tessellator);
}
Aggregations