diff --git a/ummisco.gama.annotations/src/ummisco/gama/dev/utils/FLAGS.java b/ummisco.gama.annotations/src/ummisco/gama/dev/utils/FLAGS.java
index 8547c90303..00d08f6edc 100644
--- a/ummisco.gama.annotations/src/ummisco/gama/dev/utils/FLAGS.java
+++ b/ummisco.gama.annotations/src/ummisco/gama/dev/utils/FLAGS.java
@@ -84,7 +84,7 @@ private static boolean get(final String name, final boolean def) {
* org.eclipse.swt.internal.DPIUtil.SWT_AUTOSCALE, enabling more precise scaling methods for HiDPI screens.
* Otherwise the default is used by DPIUtil (see #3180). False by default.
*/
-// public static final boolean USE_PRECISE_AUTOSCALE = get("use_precise_autoscale", false);
+ // public static final boolean USE_PRECISE_AUTOSCALE = get("use_precise_autoscale", false);
/**
* Used in GamlEditor, see #2950. Set to true to disable editing gaml files. False by default.
@@ -115,6 +115,6 @@ private static boolean get(final String name, final boolean def) {
* GLCanvas. Advantages are multiple (smaller memory footprint, immediate opening and resizing, etc.), and only a
* few glitches remain (esp. on macOS). True by defautl
*/
-// public static final boolean USE_NATIVE_OPENGL_WINDOW = get("use_native_opengl_window", true);
+ public static final boolean USE_NATIVE_OPENGL_WINDOW = get("use_native_opengl_window", true);
}
diff --git a/ummisco.gama.opengl/src/ummisco/gama/opengl/renderer/JOGLRenderer.java b/ummisco.gama.opengl/src/ummisco/gama/opengl/renderer/JOGLRenderer.java
index 363efc2ba1..9e3fcd6cb3 100644
--- a/ummisco.gama.opengl/src/ummisco/gama/opengl/renderer/JOGLRenderer.java
+++ b/ummisco.gama.opengl/src/ummisco/gama/opengl/renderer/JOGLRenderer.java
@@ -143,7 +143,7 @@ public void setCanvas(final GamaGLCanvas canvas) {
@Override
public void init(final GLAutoDrawable drawable) {
-// if (!FLAGS.USE_NATIVE_OPENGL_WINDOW) { WorkbenchHelper.asyncRun(() -> canvas.setVisible(visible)); }
+ if (!FLAGS.USE_NATIVE_OPENGL_WINDOW) { WorkbenchHelper.asyncRun(() -> canvas.setVisible(visible)); }
openGL.setGL2(drawable.getGL().getGL2());
cameraHelper.initialize();
openGL.initializeGLStates(data.getBackgroundColor());
diff --git a/ummisco.gama.opengl/src/ummisco/gama/opengl/view/GamaGLAnimator.java b/ummisco.gama.opengl/src/ummisco/gama/opengl/view/GamaGLAnimator.java
index 17aa6c415b..48e7733861 100644
--- a/ummisco.gama.opengl/src/ummisco/gama/opengl/view/GamaGLAnimator.java
+++ b/ummisco.gama.opengl/src/ummisco/gama/opengl/view/GamaGLAnimator.java
@@ -6,21 +6,18 @@
* (c) 2007-2022 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
- *
+ *
********************************************************************************************************/
package ummisco.gama.opengl.view;
import static msi.gama.runtime.PlatformHelper.isARM;
import java.io.PrintStream;
-import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
-import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.FPSCounter;
import com.jogamp.opengl.GLAnimatorControl;
import com.jogamp.opengl.GLAutoDrawable;
-import com.jogamp.opengl.GLAnimatorControl.UncaughtExceptionHandler;
import msi.gama.common.preferences.GamaPreferences;
import msi.gama.runtime.PlatformHelper;
@@ -44,18 +41,69 @@ public class GamaGLAnimator implements Runnable, GLAnimatorControl, GLAnimatorCo
protected final Thread animatorThread;
/** The drawable. */
- private final GLWindow window;
+ private final GLAutoDrawable window;
/** The stop requested. */
protected volatile boolean stopRequested = false;
+ /** The fps update frames interval. */
+ private int fpsUpdateFramesInterval = 50;
+ /** The fps total duration. */
+ private long fpsStartTime, fpsLastUpdateTime, fpsLastPeriod, fpsTotalDuration;
+
+ /** The fps total frames. */
+ private int fpsTotalFrames;
+ /** The fps total. */
+ private float fpsLast, fpsTotal;
+
+ @Override
+ public void resetFPSCounter() {
+ long fpsStartTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); // overwrite startTime to real init one
+ fpsLastUpdateTime = fpsStartTime;
+ fpsLastPeriod = 0;
+ fpsTotalFrames = 0;
+ fpsLast = 0f;
+ fpsTotal = 0f;
+ fpsLastPeriod = 0;
+ fpsTotalDuration = 0;
+ }
+
+ @Override
+ public int getUpdateFPSFrames() { return fpsUpdateFramesInterval; }
+
+ @Override
+ public long getFPSStartTime() { return fpsStartTime; }
+
+ @Override
+ public long getLastFPSUpdateTime() { return fpsLastUpdateTime; }
+
+ @Override
+ public long getLastFPSPeriod() { return fpsLastPeriod; }
+
+ @Override
+ public float getLastFPS() { return fpsLast; }
+
+ @Override
+ public int getTotalFPSFrames() { return fpsTotalFrames; }
+
+ @Override
+ public long getTotalFPSDuration() { return fpsTotalDuration; }
+
+ @Override
+ public float getTotalFPS() { return fpsTotal; }
+
+ @Override
+ public void setUpdateFPSFrames(final int frames, final PrintStream out) {
+ fpsUpdateFramesInterval = frames;
+ }
+
/**
* Instantiates a new single thread GL animator.
*
* @param window
* the drawable
*/
- public GamaGLAnimator(final GLWindow window) {
+ public GamaGLAnimator(final GLAutoDrawable window) {
this.window = window;
window.setAnimator(this);
this.animatorThread = new Thread(this, "Animator thread");
@@ -63,33 +111,17 @@ public GamaGLAnimator(final GLWindow window) {
setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, null);
}
- public void displayGL() {
- if (isARM())
- WorkbenchHelper.run(() -> window.display());
- else
- window.display();
- if (capFPS) {
- final long timeSleep = 1000 / targetFPS - getLastFPSPeriod();
- try {
- if (timeSleep >= 0) { Thread.sleep(timeSleep); }
- } catch (final InterruptedException e) {}
- }
- }
-
@Override
- public boolean isStarted() {
- return animatorThread.isAlive();
- }
+ public boolean isStarted() { return animatorThread.isAlive(); }
@Override
- public Thread getThread() {
- return animatorThread;
- }
+ public Thread getThread() { return animatorThread; }
@Override
public boolean start() {
this.stopRequested = false;
this.animatorThread.start();
+ fpsStartTime = System.currentTimeMillis();
return true;
}
@@ -106,14 +138,10 @@ public boolean stop() {
}
@Override
- public boolean isAnimating() {
- return true;
- }
+ public boolean isAnimating() { return true; }
@Override
- public boolean isPaused() {
- return false;
- }
+ public boolean isPaused() { return false; }
@Override
public boolean pause() {
@@ -136,24 +164,23 @@ public void run() {
while (!window.isRealized()) {}
while (!stopRequested) {
try {
- if (isARM())
- WorkbenchHelper.run(() -> window.display());
- else
- window.display();
+ if (isARM()) {
+ WorkbenchHelper.run(() -> { if (window.isRealized()) { window.display(); } });
+ } else if (window.isRealized()) { window.display(); }
if (capFPS) {
- final long timeSleep = 1000 / targetFPS - getLastFPSPeriod();
+ final long frameDuration = 1000 / targetFPS;
+ final long timeSleep = frameDuration - fpsLastPeriod;
if (timeSleep >= 0) { Thread.sleep(timeSleep); }
}
} catch (final InterruptedException | RuntimeException ex) {
uncaughtException(this, window, ex);
}
+ tickFPS();
}
}
@Override
- public UncaughtExceptionHandler getUncaughtExceptionHandler() {
- return this;
- }
+ public UncaughtExceptionHandler getUncaughtExceptionHandler() { return this; }
@Override
public void setUncaughtExceptionHandler(final UncaughtExceptionHandler handler) {}
@@ -166,54 +193,29 @@ public void uncaughtException(final GLAnimatorControl animator, final GLAutoDraw
}
- @Override
- public void setUpdateFPSFrames(final int frames, final PrintStream out) {
- window.setUpdateFPSFrames(frames, out);
- }
-
- @Override
- public void resetFPSCounter() {
- window.resetFPSCounter();
- }
-
- @Override
- public int getUpdateFPSFrames() {
- return window.getUpdateFPSFrames();
- }
-
- @Override
- public long getFPSStartTime() {
- return window.getFPSStartTime();
- }
-
- @Override
- public long getLastFPSUpdateTime() {
- return window.getLastFPSUpdateTime();
- }
-
- @Override
- public long getLastFPSPeriod() {
- return window.getLastFPSPeriod();
- }
-
- @Override
- public float getLastFPS() {
- return window.getLastFPS();
- }
-
- @Override
- public int getTotalFPSFrames() {
- return window.getTotalFPSFrames();
- }
-
- @Override
- public long getTotalFPSDuration() {
- return window.getTotalFPSDuration();
- }
-
- @Override
- public float getTotalFPS() {
- return window.getTotalFPS();
+ /**
+ * Increases total frame count and updates values if feature is enabled and update interval is reached.
+ *
+ * Shall be called by actual FPSCounter implementing renderer, after display a new frame.
+ *
+ */
+ public final void tickFPS() {
+ fpsTotalFrames++;
+ if (fpsUpdateFramesInterval > 0 && fpsTotalFrames % fpsUpdateFramesInterval == 0) {
+ final long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
+ fpsLastPeriod = now - fpsLastUpdateTime;
+ fpsLastPeriod = Math.max(fpsLastPeriod, 1); // div 0
+ fpsLast = fpsUpdateFramesInterval * 1000f / fpsLastPeriod;
+ fpsTotalDuration = now - fpsStartTime;
+ fpsTotalDuration = Math.max(fpsTotalDuration, 1); // div 0
+ fpsTotal = fpsTotalFrames * 1000f / fpsTotalDuration;
+ fpsLastUpdateTime = now;
+ if (DEBUG.IS_ON()) {
+ StringBuilder sb = new StringBuilder();
+ String fpsLastS = String.valueOf(fpsLast);
+ fpsLastS = fpsLastS.substring(0, fpsLastS.indexOf('.') + 2);
+ }
+ }
}
}
\ No newline at end of file
diff --git a/ummisco.gama.opengl/src/ummisco/gama/opengl/view/GamaGLCanvas.java b/ummisco.gama.opengl/src/ummisco/gama/opengl/view/GamaGLCanvas.java
index c3621f6322..08d6a4889b 100644
--- a/ummisco.gama.opengl/src/ummisco/gama/opengl/view/GamaGLCanvas.java
+++ b/ummisco.gama.opengl/src/ummisco/gama/opengl/view/GamaGLCanvas.java
@@ -38,8 +38,10 @@
import com.jogamp.opengl.GLException;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GLRunnable;
+import com.jogamp.opengl.swt.GLCanvas;
import msi.gama.runtime.PlatformHelper;
+import ummisco.gama.dev.utils.FLAGS;
import ummisco.gama.opengl.camera.IMultiListener;
import ummisco.gama.opengl.renderer.IOpenGLRenderer;
import ummisco.gama.ui.bindings.IDelegateEventsToParent;
@@ -53,8 +55,10 @@ public class GamaGLCanvas extends Composite implements GLAutoDrawable, IDelegate
/** The canvas. */
final Control canvas;
- /** The window. */
- final GLWindow window;
+ /** The drawable. */
+ final GLAutoDrawable drawable;
+
+ final FPSCounter fpsDelegate;
/** The detached. */
protected boolean detached = false;
@@ -72,39 +76,41 @@ public GamaGLCanvas(final Composite parent, final IOpenGLRenderer renderer) {
parent.setLayout(new FillLayout());
this.setLayout(new FillLayout());
final var cap = defineCapabilities();
-
- window = GLWindow.create(cap);
- canvas = new NewtCanvasSWT(this, SWT.NONE, window);
- addControlListener(new ControlAdapter() {
- @Override
- public void controlResized(final ControlEvent e) {
- /* Detached views have not title! */
- if (PlatformHelper.isMac()) {
- final var isDetached = parent.getShell().getText().length() == 0;
- if (isDetached) {
- if (!detached) {
+ if (FLAGS.USE_NATIVE_OPENGL_WINDOW) {
+ drawable = GLWindow.create(cap);
+ canvas = new NewtCanvasSWT(this, SWT.NONE, (Window) drawable);
+ addControlListener(new ControlAdapter() {
+ @Override
+ public void controlResized(final ControlEvent e) {
+ /* Detached views have not title! */
+ if (PlatformHelper.isMac()) {
+ final var isDetached = parent.getShell().getText().length() == 0;
+ if (isDetached) {
+ if (!detached) {
+ reparentWindow();
+ detached = true;
+ }
+
+ } else if (detached) {
reparentWindow();
- detached = true;
+ detached = false;
}
-
- } else if (detached) {
- reparentWindow();
- detached = false;
}
}
- }
- });
- window.setAutoSwapBufferMode(true);
-
- window.addGLEventListener(renderer);
- final var animator = new GamaGLAnimator(window);
+ });
+ } else {
+ canvas = new GLCanvas(this, SWT.NONE, cap, null);
+ drawable = (GLAutoDrawable) canvas;
+ }
+ drawable.setAutoSwapBufferMode(true);
+
+ drawable.addGLEventListener(renderer);
+ final var animator = new GamaGLAnimator(drawable);
+ fpsDelegate = animator;
renderer.setCanvas(this);
- addDisposeListener(e -> new Thread(() -> {
- animator.stop();
- }).start());
+ addDisposeListener(e -> new Thread(() -> { animator.stop(); }).start());
}
-
/**
* Define capabilities.
*
@@ -126,218 +132,176 @@ private GLCapabilities defineCapabilities() throws GLException {
@Override
public void setRealized(final boolean realized) {
- window.setRealized(realized);
+ drawable.setRealized(realized);
}
@Override
- public boolean isRealized() {
- return window.isRealized();
- }
+ public boolean isRealized() { return drawable.isRealized(); }
@Override
- public int getSurfaceWidth() {
- return window.getSurfaceWidth();
- }
+ public int getSurfaceWidth() { return drawable.getSurfaceWidth(); }
@Override
- public int getSurfaceHeight() {
- return window.getSurfaceHeight();
- }
+ public int getSurfaceHeight() { return drawable.getSurfaceHeight(); }
@Override
- public boolean isGLOriented() {
- return window.isGLOriented();
- }
+ public boolean isGLOriented() { return drawable.isGLOriented(); }
@Override
public void swapBuffers() throws GLException {
- window.swapBuffers();
+ drawable.swapBuffers();
}
@Override
- public GLCapabilitiesImmutable getChosenGLCapabilities() {
- return window.getChosenGLCapabilities();
- }
+ public GLCapabilitiesImmutable getChosenGLCapabilities() { return drawable.getChosenGLCapabilities(); }
@Override
- public GLCapabilitiesImmutable getRequestedGLCapabilities() {
- return window.getRequestedGLCapabilities();
- }
+ public GLCapabilitiesImmutable getRequestedGLCapabilities() { return drawable.getRequestedGLCapabilities(); }
@Override
- public GLProfile getGLProfile() {
- return window.getGLProfile();
- }
+ public GLProfile getGLProfile() { return drawable.getGLProfile(); }
@Override
- public NativeSurface getNativeSurface() {
- return window.getNativeSurface();
- }
+ public NativeSurface getNativeSurface() { return drawable.getNativeSurface(); }
@Override
- public long getHandle() {
- return window.getHandle();
- }
+ public long getHandle() { return drawable.getHandle(); }
@Override
- public GLDrawableFactory getFactory() {
- return window.getFactory();
- }
+ public GLDrawableFactory getFactory() { return drawable.getFactory(); }
@Override
- public GLDrawable getDelegatedDrawable() {
- return window.getDelegatedDrawable();
- }
+ public GLDrawable getDelegatedDrawable() { return drawable.getDelegatedDrawable(); }
@Override
- public GLContext getContext() {
- return window.getContext();
- }
+ public GLContext getContext() { return drawable.getContext(); }
@Override
public GLContext setContext(final GLContext newCtx, final boolean destroyPrevCtx) {
- return window.setContext(newCtx, destroyPrevCtx);
+ return drawable.setContext(newCtx, destroyPrevCtx);
}
@Override
public void addGLEventListener(final GLEventListener listener) {
- window.addGLEventListener(listener);
+ drawable.addGLEventListener(listener);
}
@Override
public void addGLEventListener(final int index, final GLEventListener listener) throws IndexOutOfBoundsException {
- window.addGLEventListener(index, listener);
+ drawable.addGLEventListener(index, listener);
}
@Override
- public int getGLEventListenerCount() {
- return window.getGLEventListenerCount();
- }
+ public int getGLEventListenerCount() { return drawable.getGLEventListenerCount(); }
@Override
public boolean areAllGLEventListenerInitialized() {
- return window.areAllGLEventListenerInitialized();
+ return drawable.areAllGLEventListenerInitialized();
}
@Override
public GLEventListener getGLEventListener(final int index) throws IndexOutOfBoundsException {
- return window.getGLEventListener(index);
+ return drawable.getGLEventListener(index);
}
@Override
public boolean getGLEventListenerInitState(final GLEventListener listener) {
- return window.getGLEventListenerInitState(listener);
+ return drawable.getGLEventListenerInitState(listener);
}
@Override
public void setGLEventListenerInitState(final GLEventListener listener, final boolean initialized) {
- window.setGLEventListenerInitState(listener, initialized);
+ drawable.setGLEventListenerInitState(listener, initialized);
}
@Override
public GLEventListener disposeGLEventListener(final GLEventListener listener, final boolean remove) {
- return window.disposeGLEventListener(listener, remove);
+ return drawable.disposeGLEventListener(listener, remove);
}
@Override
public GLEventListener removeGLEventListener(final GLEventListener listener) {
- return window.removeGLEventListener(listener);
+ return drawable.removeGLEventListener(listener);
}
@Override
public void setAnimator(final GLAnimatorControl animatorControl) throws GLException {
- window.setAnimator(animatorControl);
+ drawable.setAnimator(animatorControl);
}
@Override
- public GLAnimatorControl getAnimator() {
- return window.getAnimator();
- }
+ public GLAnimatorControl getAnimator() { return drawable.getAnimator(); }
@Override
public Thread setExclusiveContextThread(final Thread t) throws GLException {
- return window.setExclusiveContextThread(t);
+ return drawable.setExclusiveContextThread(t);
}
@Override
- public Thread getExclusiveContextThread() {
- return window.getExclusiveContextThread();
- }
+ public Thread getExclusiveContextThread() { return drawable.getExclusiveContextThread(); }
@Override
public boolean invoke(final boolean wait, final GLRunnable glRunnable) throws IllegalStateException {
- return window.invoke(wait, glRunnable);
+ return drawable.invoke(wait, glRunnable);
}
@Override
public boolean invoke(final boolean wait, final List glRunnables) throws IllegalStateException {
- return window.invoke(wait, glRunnables);
+ return drawable.invoke(wait, glRunnables);
}
@Override
public void flushGLRunnables() {
- window.flushGLRunnables();
+ drawable.flushGLRunnables();
}
@Override
public void destroy() {
- window.destroy();
+ drawable.destroy();
}
@Override
public void display() {
- window.display();
+ drawable.display();
}
@Override
public void setAutoSwapBufferMode(final boolean enable) {
- window.setAutoSwapBufferMode(enable);
+ drawable.setAutoSwapBufferMode(enable);
}
@Override
- public boolean getAutoSwapBufferMode() {
- return window.getAutoSwapBufferMode();
- }
+ public boolean getAutoSwapBufferMode() { return drawable.getAutoSwapBufferMode(); }
@Override
public void setContextCreationFlags(final int flags) {
- window.setContextCreationFlags(flags);
+ drawable.setContextCreationFlags(flags);
}
@Override
- public int getContextCreationFlags() {
- return window.getContextCreationFlags();
- }
+ public int getContextCreationFlags() { return drawable.getContextCreationFlags(); }
@Override
public GLContext createContext(final GLContext shareWith) {
- return window.createContext(shareWith);
+ return drawable.createContext(shareWith);
}
@Override
- public GL getGL() {
- return window.getGL();
- }
+ public GL getGL() { return drawable.getGL(); }
@Override
public GL setGL(final GL gl) {
- return window.setGL(gl);
+ return drawable.setGL(gl);
}
@Override
- public Object getUpstreamWidget() {
- return window.getUpstreamWidget();
- }
+ public Object getUpstreamWidget() { return drawable.getUpstreamWidget(); }
@Override
- public RecursiveLock getUpstreamLock() {
- return window.getUpstreamLock();
- }
+ public RecursiveLock getUpstreamLock() { return drawable.getUpstreamLock(); }
@Override
- public boolean isThreadGLCapable() {
- return window.isThreadGLCapable();
- }
+ public boolean isThreadGLCapable() { return drawable.isThreadGLCapable(); }
/**
* Gets the NEWT window.
@@ -345,17 +309,16 @@ public boolean isThreadGLCapable() {
* @return the NEWT window
*/
public Window getNEWTWindow() {
- // if (FLAGS.USE_NATIVE_OPENGL_WINDOW)
- return window;
- // return null;
+ if (FLAGS.USE_NATIVE_OPENGL_WINDOW) return (Window) drawable;
+ return null;
}
/**
* Reparent window.
*/
public void reparentWindow() {
- // if (!FLAGS.USE_NATIVE_OPENGL_WINDOW) return;
- final Window w = window;
+ if (!FLAGS.USE_NATIVE_OPENGL_WINDOW) return;
+ final Window w = (Window) drawable;
w.setVisible(false);
w.setFullscreen(true);
w.setFullscreen(false);
@@ -369,8 +332,8 @@ public void reparentWindow() {
* the new window visible
*/
public void setWindowVisible(final boolean b) {
- // if (!FLAGS.USE_NATIVE_OPENGL_WINDOW) return;
- final Window w = window;
+ if (!FLAGS.USE_NATIVE_OPENGL_WINDOW) return;
+ final Window w = (Window) drawable;
w.setVisible(b);
}
@@ -388,7 +351,7 @@ public boolean setFocus() {
public void addCameraListeners(final IMultiListener camera) {
WorkbenchHelper.asyncRun(() -> {
- if (isDisposed() || canvas.isDisposed()) { return; }
+ if (isDisposed() || canvas.isDisposed()) return;
canvas.addKeyListener(camera);
canvas.addMouseListener(camera);
canvas.addMouseMoveListener(camera);
@@ -399,8 +362,10 @@ public void addCameraListeners(final IMultiListener camera) {
addMouseMoveListener(camera);
addMouseWheelListener(camera);
addMouseTrackListener(camera);
- window.addKeyListener(camera);
- window.addMouseListener(camera);
+ if (drawable instanceof Window w) {
+ w.addKeyListener(camera);
+ w.addMouseListener(camera);
+ }
});
}
@@ -412,7 +377,7 @@ public void addCameraListeners(final IMultiListener camera) {
*/
public void removeCameraListeners(final IMultiListener camera) {
WorkbenchHelper.asyncRun(() -> {
- if (isDisposed() || canvas.isDisposed()) { return; }
+ if (isDisposed() || canvas.isDisposed()) return;
canvas.removeKeyListener(camera);
canvas.removeMouseListener(camera);
canvas.removeMouseMoveListener(camera);
@@ -423,61 +388,51 @@ public void removeCameraListeners(final IMultiListener camera) {
removeMouseMoveListener(camera);
removeMouseWheelListener(camera);
removeMouseTrackListener(camera);
- window.removeKeyListener(camera);
- window.removeMouseListener(camera);
+ if (drawable instanceof Window w) {
+ w.removeKeyListener(camera);
+ w.removeMouseListener(camera);
+ }
});
}
@Override
public void setUpdateFPSFrames(final int frames, final PrintStream out) {
- window.setUpdateFPSFrames(frames, out);
+ fpsDelegate.setUpdateFPSFrames(frames, out);
}
@Override
public void resetFPSCounter() {
- window.resetFPSCounter();
+ fpsDelegate.resetFPSCounter();
}
@Override
public int getUpdateFPSFrames() {
- return window.getUpdateFPSFrames();
+ return fpsDelegate.getUpdateFPSFrames();
}
@Override
- public long getFPSStartTime() {
- return window.getFPSStartTime();
- }
+ public long getFPSStartTime() { return fpsDelegate.getFPSStartTime(); }
@Override
public long getLastFPSUpdateTime() {
- return window.getLastFPSUpdateTime();
+ return fpsDelegate.getLastFPSUpdateTime();
}
@Override
- public long getLastFPSPeriod() {
- return window.getLastFPSPeriod();
- }
+ public long getLastFPSPeriod() { return fpsDelegate.getLastFPSPeriod(); }
@Override
- public float getLastFPS() {
- return window.getLastFPS();
- }
+ public float getLastFPS() { return fpsDelegate.getLastFPS(); }
@Override
- public int getTotalFPSFrames() {
- return window.getTotalFPSFrames();
- }
+ public int getTotalFPSFrames() { return fpsDelegate.getTotalFPSFrames(); }
@Override
- public long getTotalFPSDuration() {
- return window.getTotalFPSDuration();
- }
+ public long getTotalFPSDuration() { return fpsDelegate.getTotalFPSDuration(); }
@Override
- public float getTotalFPS() {
- return window.getTotalFPS();
- }
+ public float getTotalFPS() { return fpsDelegate.getTotalFPS(); }
}
diff --git a/ummisco.gama.opengl/src/ummisco/gama/opengl/view/OpenGLDisplayView.java b/ummisco.gama.opengl/src/ummisco/gama/opengl/view/OpenGLDisplayView.java
index bf4546752b..2e05edd9cf 100644
--- a/ummisco.gama.opengl/src/ummisco/gama/opengl/view/OpenGLDisplayView.java
+++ b/ummisco.gama.opengl/src/ummisco/gama/opengl/view/OpenGLDisplayView.java
@@ -84,9 +84,9 @@ public boolean forceOverlayVisibility() {
// */
@Override
public IDisposable getMultiListener() {
-// if (FLAGS.USE_NATIVE_OPENGL_WINDOW)
+ if (FLAGS.USE_NATIVE_OPENGL_WINDOW)
return new NEWTLayeredDisplayMultiListener(decorator, getDisplaySurface(), getGLCanvas().getNEWTWindow());
-// return super.getMultiListener();
+ return super.getMultiListener();
}
@Override