예제 #1
0
  /** ***************************************************** */
  public void draw(GL2 gl, GLU glu, Camera cam) {
    if (transform != null) transform.execute(gl);
    gl.glTranslatef(x, y, z);

    applyMaterial(gl);
    gl.glLineWidth(wfwidth);

    // Draw
    GLUquadric qobj = glu.gluNewQuadric();

    if (facestatus) {
      if (wfstatus) {
        gl.glEnable(GL2.GL_POLYGON_OFFSET_FILL);
        gl.glPolygonOffset(1.0f, 1.0f);
      }

      gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_FILL);
      gl.glNormal3f(norm.x, norm.y, norm.z);
      gl.glColor4f(color.r, color.g, color.b, color.a);
      glu.gluDisk(qobj, radiusInner, radiusOuter, slices, loops);

      if (wfstatus) gl.glDisable(GL2.GL_POLYGON_OFFSET_FILL);
    }
    if (wfstatus) {
      gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE);
      gl.glNormal3f(norm.x, norm.y, norm.z);
      gl.glColor4f(wfcolor.r, wfcolor.g, wfcolor.b, wfcolor.a);
      glu.gluDisk(qobj, radiusInner, radiusOuter, slices, loops);
    }
  }
예제 #2
0
  @Override
  public void drawCD(double internalRadius, double externalRadius, int slices, int rings) {
    GLUquadric quadratic = glu.gluNewQuadric();

    glu.gluDisk(
        quadratic, Math.max(internalRadius * scaleX, 1), externalRadius * scaleX, slices, rings);

    glu.gluDeleteQuadric(quadratic);
  }
예제 #3
0
파일: Bullet.java 프로젝트: xranby/jogltest
 public void render(GLAutoDrawable drawable) {
   GL2 gl = drawable.getGL().getGL2();
   gl.glPushMatrix();
   gl.glTranslated(
       body.getPosition().get0(), body.getPosition().get1(), body.getPosition().get2());
   GLUquadric bulletGeom = glu.gluNewQuadric();
   glu.gluQuadricDrawStyle(bulletGeom, GLU.GLU_FILL);
   glu.gluQuadricNormals(bulletGeom, GLU.GLU_SMOOTH);
   glu.gluDisk(bulletGeom, 0.3, 0.4, 5, 5);
   gl.glPopMatrix();
 }
예제 #4
0
  public void draw(GL2 gl, GLU glu) {
    gl.glColor3f(1f, 0f, .25f);

    // Lamp Stem, cylindrical, a little smaller at the top.
    gl.glPushMatrix();
    gl.glRotatef(-90f, 1f, 0f, 0f); // stand upright (Y)
    glu.gluCylinder(quadric, 1., 1, 3., 10, 1);
    gl.glPopMatrix();

    // Table Top
    gl.glPushMatrix();
    gl.glTranslated(0, 3, 0);
    gl.glRotatef(-90f, 100f, 0f, 0f); // stand upright (Y)
    glu.gluDisk(quadric, 0, 4., 15, 5); // also to be flipped
    gl.glPopMatrix();
  }