Esempio n. 1
0
 public void areaPoints(PointCallback cb) {
   try {
     cb.handle((int) cx.getValue(), (int) cy.getValue());
   } catch (NullPointerException npe) {
     return;
   }
 }
  /**
   * Draw the the given shape filled in. Only the vertices are set. The colour has to be set
   * independently of this method.
   *
   * @param shape The shape to fill.
   * @param callback The callback that will be invoked for each shape point
   */
  private static final void fill(Shape shape, PointCallback callback) {
    Triangulator tris = shape.getTriangles();

    GL.glBegin(SGL.GL_TRIANGLES);
    for (int i = 0; i < tris.getTriangleCount(); i++) {
      for (int p = 0; p < 3; p++) {
        float[] pt = tris.getTrianglePoint(i, p);
        float[] np = callback.preRenderPoint(shape, pt[0], pt[1]);

        if (np == null) {
          GL.glVertex2f(pt[0], pt[1]);
        } else {
          GL.glVertex2f(np[0], np[1]);
        }
      }
    }
    GL.glEnd();
  }