示例#1
0
文件: GOut.java 项目: krvd/hnh_union
 public void line(Coord c1, Coord c2, double w) {
   texsel(-1);
   gl.glLineWidth((float) w);
   gl.glBegin(GL.GL_LINES);
   glcolor();
   vertex(c1);
   vertex(c2);
   gl.glEnd();
   checkerr();
 }
示例#2
0
 public void line(Coord c1, Coord c2, double w) {
   st.set(cur2d);
   apply();
   gl.glLineWidth((float) w);
   gl.glBegin(GL.GL_LINES);
   vertex(c1);
   vertex(c2);
   gl.glEnd();
   checkerr();
 }
示例#3
0
文件: GOut.java 项目: krvd/hnh_union
 public void frect(Coord c1, Coord c2, Coord c3, Coord c4) {
   glcolor();
   texsel(-1);
   gl.glBegin(GL.GL_QUADS);
   vertex(c1);
   vertex(c2);
   vertex(c3);
   vertex(c4);
   gl.glEnd();
   checkerr();
 }
示例#4
0
文件: GOut.java 项目: krvd/hnh_union
 public void frect(Coord ul, Coord sz) {
   glcolor();
   texsel(-1);
   gl.glBegin(GL.GL_QUADS);
   vertex(ul);
   vertex(ul.add(new Coord(sz.x, 0)));
   vertex(ul.add(sz));
   vertex(ul.add(new Coord(0, sz.y)));
   gl.glEnd();
   checkerr();
 }
示例#5
0
 public void frect(Coord c1, Coord c2, Coord c3, Coord c4) {
   st.set(cur2d);
   apply();
   gl.glBegin(GL2.GL_QUADS);
   vertex(c1);
   vertex(c2);
   vertex(c3);
   vertex(c4);
   gl.glEnd();
   checkerr();
 }
示例#6
0
 public void rect(Coord ul, Coord sz) {
   st.set(cur2d);
   apply();
   gl.glLineWidth(1);
   gl.glBegin(GL.GL_LINE_LOOP);
   vertex(ul.x + 0.5f, ul.y + 0.5f);
   vertex(ul.x + sz.x - 0.5f, ul.y + 0.5f);
   vertex(ul.x + sz.x - 0.5f, ul.y + sz.y - 0.5f);
   vertex(ul.x + 0.5f, ul.y + sz.y - 0.5f);
   gl.glEnd();
   checkerr();
 }
示例#7
0
 public void fellipse(Coord c, Coord r, int a1, int a2) {
   st.set(cur2d);
   apply();
   gl.glBegin(GL.GL_TRIANGLE_FAN);
   vertex(c);
   for (int i = a1; i <= a2; i += 5) {
     double a = (i * Math.PI * 2) / 360.0;
     vertex(c.add((int) (Math.cos(a) * r.x), -(int) (Math.sin(a) * r.y)));
   }
   gl.glEnd();
   checkerr();
 }
示例#8
0
文件: GOut.java 项目: krvd/hnh_union
 public void fellipse(Coord c, Coord r, int a1, int a2) {
   glcolor();
   texsel(-1);
   gl.glBegin(GL.GL_TRIANGLE_FAN);
   vertex(c);
   for (int i = a1; i < a2; i += 5) {
     double a = (i * Math.PI * 2) / 360.0;
     vertex(c.add((int) (Math.cos(a) * r.x), -(int) (Math.sin(a) * r.y)));
   }
   double a = (a2 * Math.PI * 2) / 360.0;
   vertex(c.add((int) (Math.cos(a) * r.x), -(int) (Math.sin(a) * r.y)));
   gl.glEnd();
   checkerr();
 }
示例#9
0
 public void poly(Coord... c) {
   st.set(cur2d);
   apply();
   gl.glBegin(GL2.GL_POLYGON);
   for (Coord vc : c) vertex(vc);
   gl.glEnd();
   checkerr();
 }
示例#10
0
文件: GOut.java 项目: krvd/hnh_union
 public void ftriangle(Coord center, int size) {
   if (size < 1) return;
   double sqrt3 = Math.sqrt(3);
   double Orad = (sqrt3 * size) / 3;
   double Irad = (sqrt3 * size) / 6;
   Coord c1, c2, c3;
   c1 = new Coord(center.x, center.y - (int) Orad);
   c2 = new Coord(center.x + (int) (size / 2) - 1, center.y + (int) Irad);
   c3 = new Coord(center.x - (int) (size / 2) + 1, center.y + (int) Irad);
   glcolor();
   texsel(-1);
   gl.glBegin(GL.GL_TRIANGLE_STRIP);
   vertex(c1);
   vertex(c2);
   vertex(c3);
   gl.glEnd();
   checkerr();
 }
示例#11
0
 public void poly2(Object... c) {
   st.set(cur2d);
   st.put(States.color, States.vertexcolor);
   apply();
   gl.glBegin(GL2.GL_POLYGON);
   for (int i = 0; i < c.length; i += 2) {
     Coord vc = (Coord) c[i];
     Color col = (Color) c[i + 1];
     gl.glColor4f(
         (col.getRed() / 255.0f),
         (col.getGreen() / 255.0f),
         (col.getBlue() / 255.0f),
         (col.getAlpha() / 255.0f));
     vertex(vc);
   }
   gl.glEnd();
   checkerr();
 }
示例#12
0
  public void prect(Coord c, Coord ul, Coord br, double a) {
    st.set(cur2d);
    apply();
    gl.glEnable(GL2.GL_POLYGON_SMOOTH);
    gl.glBegin(GL.GL_TRIANGLE_FAN);
    vertex(c);
    vertex(c.add(0, ul.y));
    double p2 = Math.PI / 2;
    all:
    {
      float tc;

      tc = (float) (Math.tan(a) * -ul.y);
      if ((a > p2) || (tc > br.x)) {
        vertex(c.x + br.x, c.y + ul.y);
      } else {
        vertex(c.x + tc, c.y + ul.y);
        break all;
      }

      tc = (float) (Math.tan(a - (Math.PI / 2)) * br.x);
      if ((a > p2 * 2) || (tc > br.y)) {
        vertex(c.x + br.x, c.y + br.y);
      } else {
        vertex(c.x + br.x, c.y + tc);
        break all;
      }

      tc = (float) (-Math.tan(a - Math.PI) * br.y);
      if ((a > p2 * 3) || (tc < ul.x)) {
        vertex(c.x + ul.x, c.y + br.y);
      } else {
        vertex(c.x + tc, c.y + br.y);
        break all;
      }

      tc = (float) (-Math.tan(a - (3 * Math.PI / 2)) * -ul.x);
      if ((a > p2 * 4) || (tc < ul.y)) {
        vertex(c.x + ul.x, c.y + ul.y);
      } else {
        vertex(c.x + ul.x, c.y + tc);
        break all;
      }

      tc = (float) (Math.tan(a) * -ul.y);
      vertex(c.x + tc, c.y + ul.y);
    }
    gl.glEnd();
    gl.glDisable(GL2.GL_POLYGON_SMOOTH);
    checkerr();
  }