protected void runLoop(){
        if (!created.get())
            throw new IllegalStateException();

        listener.update();
        
        // All this does is call update().
        // If the canvas is not active, there's no need to waste time
        // doing that.
        if (renderable.get()){
            assert checkGLError();

            // calls swap buffers, etc.
            try {
                if (allowSwapBuffers && autoFlush) {
                    Display.update(false);
                } 
            } catch (Throwable ex){
                listener.handleError("Error while swapping buffers", ex);
            }
        }

        int frameRateCap;
        if (autoFlush) {
            frameRateCap = frameRate;
        } else {
            frameRateCap = 20;
        }
        
        if (frameRateCap > 0) {
            // Cap framerate
            Display.sync(frameRateCap);
        }
        
        // check input after we synchronize with framerate.
        // this reduces input lag.
        if (renderable.get()){
            Display.processMessages();
        }
        
        // Subclasses just call GLObjectManager. Clean up objects here.
        // It is safe ... for now.
        renderer.postFrame();
    }
execute one iteration of the render loop in the OpenGL thread
jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglAbstractDisplay.java