コード例 #1
0
  private void drawLine(int X1, int Y1, int X2, int Y2, float color[]) {
    GL11.glColor3f(color[0], color[1], color[2]);

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(X1, Y1);
    GL11.glVertex2f(X2, Y2);
    GL11.glEnd();
  }
コード例 #2
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();
  }
コード例 #3
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();
  }