Пример #1
0
  private void drawQuad(int x, int y, int h, int w, float color[], float alpha) {
    GL11.glColor4f(color[0], color[1], color[2], alpha);

    // draw quad
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2f(x, y);
    GL11.glVertex2f(x + w, y);
    GL11.glVertex2f(x + w, y + h);
    GL11.glVertex2f(x, y + h);
    GL11.glEnd();
  }
Пример #2
0
  private void drawCircle(double x, double y, int radius, float color[], float alpha) {
    GL11.glColor4f(color[0], color[1], color[2], alpha);

    float incr = (float) (2 * Math.PI / slices);
    /*xCoord = xCoord + radius;
    yCoord = yCoord + radius;*/

    GL11.glBegin(GL11.GL_TRIANGLE_FAN);
    for (int i = 0; i < slices; i++) {
      float angle = incr * i;

      float Xc = (float) (x + Math.cos(angle) * radius);
      float Yc = (float) (y + Math.sin(angle) * radius);

      GL11.glVertex2f(Xc, Yc);
    }
    GL11.glEnd();
  }