Example #1
0
  /**
   * Rendering method.
   *
   * @param gl
   */
  public final void render(GL2 gl) {
    boolean displayListsAllowedByLayoutManager = false;
    if (layoutManager != null) {
      displayListsAllowedByLayoutManager = layoutManager.isUseDisplayLists();
    }

    if (displayListsAllowedByLayoutManager
        && !hasDisplayListIndex
        && permitsWrappingDisplayLists()) {
      displayListIndex = gl.glGenLists(1);
      hasDisplayListIndex = true;
    }

    prepare();

    if (isDisplayListDirty()
        && permitsWrappingDisplayLists()
        && displayListsAllowedByLayoutManager) {
      gl.glNewList(displayListIndex, GL2.GL_COMPILE);
      renderContent(gl);
      gl.glEndList();
      setDisplayListDirty(false);
    }

    if (permitsWrappingDisplayLists() && displayListsAllowedByLayoutManager) {
      gl.glCallList(displayListIndex);
    } else {
      renderContent(gl);
    }
  }
  public void selfDraw(GL2 gl) {

    texture.enable(gl);
    texture.bind(gl);

    gl.glTranslatef(8.65f, -0.8f, 8.8f);

    gl.glPushMatrix();
    gl.glScalef(3f, 3f, 3f);
    gl.glCallList(startList);
    gl.glPopMatrix();
  }
Example #3
0
  @Override
  public void display(GL2 gl) {

    if (isDisplayListDirty && !bIsAnimationActive) {
      buildDisplayList(gl, displayListIndex);
      isDisplayListDirty = false;
    }

    if (pdRealRootElement != null && pdCurrentRootElement != null) {

      if (upwardNavigationSlider.handleDragging(gl, glMouseListener, pixelGLConverter)) {
        updateHierarchyAccordingToNavigationSlider();
      }
      // clipToFrustum(gl);
      //
      if (bIsAnimationActive) {
        float fXCenter = viewFrustum.getWidth() / 2;
        float fYCenter = viewFrustum.getHeight() / 2;

        gl.glLoadIdentity();
        upwardNavigationSlider.draw(
            gl,
            pickingManager,
            textureManager,
            uniqueID,
            iUpwardNavigationSliderID,
            iUpwardNavigationSliderButtonID,
            iUpwardNavigationSliderBodyID);

        float fCurrentSliderWidth = upwardNavigationSlider.getScaledWidth(gl);
        float fCurrentSliderHeight = upwardNavigationSlider.getScaledHeight(gl);

        controlBox.setRectangle(
            0, 0, fCurrentSliderWidth * 2, fCurrentSliderHeight + fCurrentSliderWidth);
        LabelManager.get().setControlBox(controlBox);
        drawingController.draw(fXCenter, fYCenter, gl, new GLU());
      } else gl.glCallList(displayListIndex);
    } else {
      renderSymbol(gl, EIconTextures.RADIAL_SYMBOL.getFileName(), 0.5f);
    }
    if (!lazyMode) checkForHits(gl);
  }
Example #4
0
  private void renderTeapot(
      GL2 gl,
      float x,
      float y,
      float z,
      float ambr,
      float ambg,
      float ambb,
      float difr,
      float difg,
      float difb,
      float specr,
      float specg,
      float specb,
      float shine) {
    float mat[] = new float[4];

    gl.glPushMatrix();
    gl.glTranslatef(x, y, z);
    mat[0] = ambr;
    mat[1] = ambg;
    mat[2] = ambb;
    mat[3] = 1.0f;
    gl.glMaterialfv(GL.GL_FRONT, GL2.GL_SPECULAR, mat, 0);
    mat[0] = difr;
    mat[1] = difg;
    mat[2] = difb;
    gl.glMaterialfv(GL.GL_FRONT, GL2.GL_DIFFUSE, mat, 0);
    mat[0] = specr;
    mat[1] = specg;
    mat[2] = specb;
    gl.glMaterialfv(GL.GL_FRONT, GL2.GL_SPECULAR, mat, 0);
    gl.glMaterialf(GL.GL_FRONT, GL2.GL_SHININESS, shine * 128.0f);
    gl.glCallList(teapotList);
    gl.glPopMatrix();
  }
  @Override
  public void render(GL2 gl, float trajectory) {
    if (!dead) {
      gl.glPushMatrix();
      {
        gl.glTranslatef(bound.c.x, bound.c.y, bound.c.z);
        gl.glRotatef(rotation, 0, -1, 0);
        gl.glScalef(1.5f, 1.5f, 1.5f);

        Shader shader = Shader.getLightModel("texture");
        if (shader != null) shader.enable(gl);

        gl.glCallList(shellList);

        spikeNode.render(gl);
        rimNode.render(gl);
      }
      gl.glPopMatrix();

      Shader.disable(gl);
    } else if (!blast.isEmpty() && !Scene.shadowMode) {
      boolean useHDR = BloomStrobe.isEnabled();

      if (Scene.reflectMode) BloomStrobe.end(gl);

      if (Scene.singleton.enableBloom) renderBlast(gl);
      else BlastParticle.renderList(gl, blast);

      if (useHDR) BloomStrobe.begin(gl);

      Shader.disable(gl);
    }

    if (blastDuration <= 1) blastLight.disable(gl);
    else blastLight.enable(gl);
  }
Example #6
0
 /* (non-Javadoc)
  * @see org.sam.jogl.Dibujable#draw(javax.media.opengl.GL2)
  */
 @Override
 public void draw(GL2 gl) {
   gl.glCallList(idList);
 }