@Override
  public void draw(GL2 gl, Object obj) {
    if (!(Force.class.isAssignableFrom(obj.getClass()))) return;

    Force force = (Force) obj;

    gl.glLineWidth(2.5f);
    gl.glColor3f(1.0f, 0f, 0f);
    gl.glBegin(GL.GL_LINES);
    gl.glVertex3d(
        force.getPointApplication().getX(),
        force.getPointApplication().getY(),
        force.getPointApplication().getZ());

    Vector3D finalPoint = force.getPointApplication().add(force.getForce());
    gl.glVertex3d(finalPoint.getX(), finalPoint.getY(), finalPoint.getZ());
    gl.glEnd();

    gl.glTranslated(
        force.getPointApplication().getX(),
        force.getPointApplication().getY(),
        force.getPointApplication().getZ());
    gl.glColor3f(1.0f, 0.0f, 0.0f);
    GLU glu = new GLU();
    GLUquadric q = glu.gluNewQuadric();
    glu.gluQuadricDrawStyle(q, GLU.GLU_FILL);
    glu.gluSphere(q, Force.originRadius, 5, 5);
    glu.gluDeleteQuadric(q);
  }
  private void renderBlast(GL2 gl) {
    GLU glu = new GLU();

    Shader shader = Shader.get("dissolve");
    if (shader != null) {
      shader.enable(gl);

      shader.setSampler(gl, "cloudSampler", 0);
      shader.setUniform(gl, "dissolveFactor", 1.0f - ((float) blastDuration / 60.0f));
    }

    gl.glEnable(GL2.GL_TEXTURE_2D);

    GLUquadric sphere = glu.gluNewQuadric();

    glu.gluQuadricDrawStyle(sphere, GLU.GLU_FILL);
    glu.gluQuadricTexture(sphere, true);

    gl.glPushMatrix();
    {
      noiseSampler.bind(gl);
      noiseSampler.setTexParameterf(gl, GL2.GL_TEXTURE_MAX_ANISOTROPY_EXT, 16);

      gl.glTranslatef(bound.c.x, bound.c.y, bound.c.z);

      glu.gluSphere(sphere, blastRadius, 24, 24);
    }
    gl.glPopMatrix();
  }
Exemple #3
0
 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();
 }
 public BaconTable(GLU glu) {
   quadric = glu.gluNewQuadric();
   glu.gluQuadricDrawStyle(quadric, GLU.GLU_FILL); // GLU_POINT, GLU_LINE, GLU_FILL, GLU_SILHOUETTE
   glu.gluQuadricNormals(quadric, GLU.GLU_NONE); // GLU_NONE, GLU_FLAT, or GLU_SMOOTH
   glu.gluQuadricTexture(quadric, true); // false, or true to generate texture coordinates
 }