Search in sources :

Example 1 with WindowMaterial

use of jhelp.engine.gui.components.WindowMaterial in project narchy by automenta.

the class JHelpSceneRenderer method display.

/**
 * Draw the OpenGL.<br>
 * It is call by JOGL when OpenGL need to be refresh
 *
 * @param drawable
 *           Drawable context
 * @see javax.media.opengl.GLEventListener#display(javax.media.opengl.GLAutoDrawable)
 */
@Override
public void display(final GLAutoDrawable drawable) {
    System.out.println("display: " + drawable);
    this.ready = false;
    // Get OpenGL and GLU context
    final GL2 gl = drawable.getGL().getGL2();
    final GLU glu = new GLUgl2();
    if (this.texturesToRemove.isEmpty() == false) {
        this.texturesToRemove.outQueue().removeFromMemory(gl);
    }
    // If a new scene wait, change the scene
    if (this.newScene != null) {
        this.scene = this.newScene;
        this.newScene = null;
    }
    // Update played animations
    this.playAnimations(gl);
    // Initialize for screen shot
    if ((this.screenShot == null) || (this.screenShot.getWidth() != this.width) || (this.screenShot.getHeight() != this.height)) {
        this.screenShot = null;
        this.screenShot = new JHelpImage(this.width, this.height);
    }
    // Refresh window materials
    for (final WindowMaterial windowMaterial : this.windowMaterials) {
        windowMaterial.refreshIfNeed();
    }
    // Get actual camera
    final Camera camera = this.scene.getCamera();
    // Render picking mode
    if (this.detectionActivate == true) {
        if (this.pickUVnode != null) {
            this.renderPickUV(gl, glu, camera);
        } else {
            this.renderPicking(gl, glu, camera);
        }
    }
    // Render the lights
    this.lights.render(gl);
    // Render the scene
    this.render(gl, glu, camera);
    // Take the snapshot
    this.makeSnapShot(gl, true);
    // Print FPS
    this.showFPS(gl, glu);
    // Update FPS
    this.updateFPS();
    // Make ready for the next loop
    gl.glEnable(GL2.GL_DEPTH_TEST);
    drawable.swapBuffers();
    this.ready = true;
    synchronized (this.LOCK) {
        this.LOCK.notify();
    }
}
Also used : GLU(com.jogamp.opengl.glu.GLU) GLUgl2(com.jogamp.opengl.glu.gl2.GLUgl2) JHelpImage(jhelp.util.gui.JHelpImage) WindowMaterial(jhelp.engine.gui.components.WindowMaterial) GL2(com.jogamp.opengl.GL2)

Aggregations

GL2 (com.jogamp.opengl.GL2)1 GLU (com.jogamp.opengl.glu.GLU)1 GLUgl2 (com.jogamp.opengl.glu.gl2.GLUgl2)1 WindowMaterial (jhelp.engine.gui.components.WindowMaterial)1 JHelpImage (jhelp.util.gui.JHelpImage)1