aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media/opengl/awt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-01-11 08:13:24 +0100
committerSven Gothel <[email protected]>2013-01-11 08:13:24 +0100
commit224fab1b2c71464826594740022fdcbe278867dc (patch)
treefb4292f8cd8b8fa2664c04005ba2ddde630d159c /src/jogl/classes/javax/media/opengl/awt
parent6fd9c3d84e1758ae27cd10a89237a558460ca1fb (diff)
GLAutoDrawable/AnimatorBase: Add ExclusiveContextThread (ECT) feature; AnimatorBase: Add setModeBits/MODE_EXPECT_AWT_RENDERING_THREAD; FPSAnimator: Make transactions deterministic.
ExclusiveContextThread (ECT) allows user to dedicate a GLContext to a given thread. Only the ECT will be allowed to claim the GLContext, hence releasing must be done on the ECT itself. The core feature is accessible via GLAutoDrawable, while it can be conveniently enabled and disabled via an AnimatorBase implementation. The latter ensures it's being released on the ECT and waits for the result. Note that ECT cannot be guaranteed to work correctly w/ native (heavyweight) AWT components due to resource locking and AWT-EDT access. This is disabled in all new tests per default and noted on the API doc. Note: 'Animator transaction' == start(), stop(), pause(), resume(). - Add ExclusiveContextThread (ECT) feature - GLAutoDrawable NEW: - Thread setExclusiveContextThread(Thread t) - Thread getExclusiveContextThread() - AnimatorBase NEW: - Thread setExclusiveContext(Thread t) - boolean setExclusiveContext(boolean enable) - boolean isExclusiveContextEnabled() - Thread getExclusiveContextThread() - AnimatorBase: Add setModeBits/MODE_EXPECT_AWT_RENDERING_THREAD Allows user to pre-determine whether AWT rendering is expected before starting the animator. If AWT is excluded, a more simple and transaction correct impl. will be used. - FPSAnimator: Make transactions deterministic. FPSAnimator previously did not ensure whether a transaction was completed. A deterministic transaction is required to utilize ECT. FPSAnimator now uses same mechanism like Animator to ensure completeness, i.e. Condition and 'finishLifecycleAction(..)'. Both are moved to AnimatorBase. Tested manually on Linux/NV, Linux/AMD, Windows/NV and OSX/NV. - All new tests validated correctness. - All new tests shows an performance increase of ~3x w/ single GLWindow, where multiple GLWindows don't show a perf. increase.
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/awt')
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java10
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java10
2 files changed, 20 insertions, 0 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 2f7fef9be..2de86b545 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -742,6 +742,16 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
@Override
+ public final Thread setExclusiveContextThread(Thread t) throws GLException {
+ return helper.setExclusiveContextThread(t, context);
+ }
+
+ @Override
+ public final Thread getExclusiveContextThread() {
+ return helper.getExclusiveContextThread();
+ }
+
+ @Override
public boolean invoke(boolean wait, GLRunnable glRunnable) {
return helper.invoke(this, wait, glRunnable);
}
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 23dedaa66..664edb996 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -474,6 +474,16 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
+ public final Thread setExclusiveContextThread(Thread t) throws GLException {
+ return helper.setExclusiveContextThread(t, getContext());
+ }
+
+ @Override
+ public final Thread getExclusiveContextThread() {
+ return helper.getExclusiveContextThread();
+ }
+
+ @Override
public boolean invoke(boolean wait, GLRunnable glRunnable) {
return helper.invoke(this, wait, glRunnable);
}