aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-11-05 05:02:38 +0100
committerSven Gothel <[email protected]>2012-11-05 05:02:38 +0100
commit8c78f80f205345fe43ec2639e648421ef0134e57 (patch)
tree9498900879ceba4718938d57774b19c6d41e54e5 /src/jogl/classes/com/jogamp/opengl
parent3a00361952120f8127a3014623de703ac696e036 (diff)
GLAutoDrawable: Refine API change of commit c002e04f848116922a1ed7bd96ead54961649bbd
As suggested by Julien Gouesse, align 'enqueue(..)' method w/ 'invoke(..)': - public void enqueue(GLRunnable glRunnable); + public boolean invoke(boolean wait, List<GLRunnable> glRunnables);
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java12
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java35
2 files changed, 25 insertions, 22 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
index ea794cc78..755a7c392 100644
--- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
+++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
@@ -27,6 +27,8 @@
*/
package com.jogamp.opengl.swt;
+import java.util.List;
+
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeSurface;
import javax.media.nativewindow.ProxySurface;
@@ -545,15 +547,15 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
}
@Override
- public boolean invoke(final boolean wait, final GLRunnable run) {
- return helper.invoke(this, wait, run);
+ public boolean invoke(final boolean wait, final GLRunnable runnable) {
+ return helper.invoke(this, wait, runnable);
}
@Override
- public void enqueue(GLRunnable glRunnable) {
- helper.enqueue(glRunnable);
+ public boolean invoke(final boolean wait, final List<GLRunnable> runnables) {
+ return helper.invoke(this, wait, runnables);
}
-
+
@Override
public void setAnimator(final GLAnimatorControl arg0) throws GLException {
helper.setAnimator(arg0);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
index 08eaf0494..cc81e4820 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
@@ -27,6 +27,9 @@
*/
package com.jogamp.opengl.util;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.media.opengl.GLAnimatorControl;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLContext;
@@ -80,7 +83,7 @@ public class GLDrawableUtil {
dest.addGLEventListener(listener);
if(preserveInitState && initialized) {
dest.setGLEventListenerInitState(listener, true);
- dest.enqueue(new ReshapeGLEventListener(listener));
+ dest.invoke(false, new ReshapeGLEventListener(listener));
} // else .. !init state is default
}
@@ -118,6 +121,8 @@ public class GLDrawableUtil {
* @param b
*/
public static final void swapGLContextAndAllGLEventListener(GLAutoDrawable a, GLAutoDrawable b) {
+ final List<GLRunnable> aGLCmds = new ArrayList<GLRunnable>();
+ final List<GLRunnable> bGLCmds = new ArrayList<GLRunnable>();
final GLAnimatorControl aAnim = a.getAnimator();
final GLAnimatorControl bAnim = b.getAnimator();
final boolean aIsPaused = isAnimatorAnimatingOnOtherThread(aAnim) && aAnim.pause();
@@ -146,32 +151,30 @@ public class GLDrawableUtil {
//
// trigger glFinish to sync GL ctx
//
- a.enqueue(glFinish);
- b.enqueue(glFinish);
- a.display();
- b.display();
+ a.invoke(true, glFinish);
+ b.invoke(true, glFinish);
//
// switch context and
// trigger GL-Viewport reset and reshape of all initialized GLEventListeners
//
b.setContext( a.setContext( b.getContext() ) );
- a.enqueue(setViewport);
- b.enqueue(setViewport);
+ aGLCmds.add(setViewport);
+ bGLCmds.add(setViewport);
for(int i=0; i<aSz; i++) {
if( aInit[i] ) {
- b.enqueue(new ReshapeGLEventListener(aGLE[i]));
+ bGLCmds.add(new ReshapeGLEventListener(aGLE[i]));
}
}
for(int i=0; i<bSz; i++) {
if( bInit[i] ) {
- a.enqueue(new ReshapeGLEventListener(bGLE[i]));
+ aGLCmds.add(new ReshapeGLEventListener(bGLE[i]));
}
}
- a.enqueue(glFinish);
- b.enqueue(glFinish);
- a.display();
- b.display();
+ aGLCmds.add(glFinish);
+ bGLCmds.add(glFinish);
+ a.invoke(true, aGLCmds);
+ b.invoke(true, bGLCmds);
// add all cached GLEventListener to their destination and fix their init-state
for(int i=0; i<bSz; i++) {
@@ -248,10 +251,8 @@ public class GLDrawableUtil {
}
dest.setContext( src.setContext( dest.getContext() ) );
- src.enqueue(setViewport);
- dest.enqueue(setViewport);
- src.display();
- dest.display();
+ src.invoke(true, setViewport);
+ dest.invoke(true, setViewport);
if(aIsPaused) { aAnim.resume(); }
if(bIsPaused) { bAnim.resume(); }