// SystemListener:update @Override public void onDrawFrame(GL10 gl) { if (needClose.get()) { deinitInThread(); return; } if (renderable.get()) { if (!created.get()) { throw new IllegalStateException("onDrawFrame without create"); } long milliStart = System.currentTimeMillis(); listener.update(); if (autoFlush) { renderer.onFrame(); } long milliDelta = System.currentTimeMillis() - milliStart; // Enforce a FPS cap if (milliDelta < minFrameDuration) { // logger.log(Level.INFO, "Time per frame {0}", milliDelta); try { Thread.sleep(minFrameDuration - milliDelta); } catch (InterruptedException e) { } } } }
protected void waitFor(boolean createdVal) { while (renderable.get() != createdVal) { try { Thread.sleep(10); } catch (InterruptedException ex) { } } }