diff options
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java index 655f6d688..ec6d54d66 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -44,7 +44,7 @@ import jogamp.opengl.Debug; */ public class GLDrawableUtil { protected static final boolean DEBUG = Debug.debug("GLDrawable"); - + public static final boolean isAnimatorStartedOnOtherThread(GLAnimatorControl animatorCtrl) { return ( null != animatorCtrl ) ? animatorCtrl.isStarted() && animatorCtrl.getThread() != Thread.currentThread() : false ; } @@ -56,11 +56,11 @@ public class GLDrawableUtil { public static final boolean isAnimatorAnimatingOnOtherThread(GLAnimatorControl animatorCtrl) { return ( null != animatorCtrl ) ? animatorCtrl.isAnimating() && animatorCtrl.getThread() != Thread.currentThread() : false ; } - + public static final boolean isAnimatorAnimating(GLAnimatorControl animatorCtrl) { return ( null != animatorCtrl ) ? animatorCtrl.isAnimating() : false ; } - + /** * Moves the designated {@link GLEventListener} from {@link GLAutoDrawable} <code>src</code> to <code>dest</code>. * If <code>preserveInitState</code> is <code>true</code>, it's initialized state is preserved @@ -86,7 +86,7 @@ public class GLDrawableUtil { dest.invoke(false, new GLEventListenerState.ReshapeGLEventListener(listener)); } // else .. !init state is default } - + /** * Moves all {@link GLEventListener} from {@link GLAutoDrawable} <code>src</code> to <code>dest</code>. * If <code>preserveInitState</code> is <code>true</code>, it's initialized state is preserved @@ -113,12 +113,12 @@ public class GLDrawableUtil { /** * Swaps the {@link GLContext} and all {@link GLEventListener} between {@link GLAutoDrawable} <code>a</code> and <code>b</code>, * while preserving it's initialized state, resets the GL-Viewport and issuing {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape(..)}. - * <p> - * The {@link GLAutoDrawable} to {@link GLAnimatorControl} association - * is also swapped. + * <p> + * The {@link GLAutoDrawable} to {@link GLAnimatorControl} association + * is also swapped. * </p> * <p> - * If an {@link GLAnimatorControl} is being attached to {@link GLAutoDrawable} <code>a</code> or <code>b</code> + * If an {@link GLAnimatorControl} is being attached to {@link GLAutoDrawable} <code>a</code> or <code>b</code> * and the current thread is different than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation. * </p> * @param a @@ -128,31 +128,31 @@ public class GLDrawableUtil { public static final void swapGLContextAndAllGLEventListener(GLAutoDrawable a, GLAutoDrawable b) { final GLEventListenerState gllsA = GLEventListenerState.moveFrom(a); final GLEventListenerState gllsB = GLEventListenerState.moveFrom(b); - + gllsA.moveTo(b); gllsB.moveTo(a); } - - /** - * Swaps the {@link GLContext} of given {@link GLAutoDrawable} - * and {@link GLAutoDrawable#disposeGLEventListener(GLEventListener, boolean) disposes} + + /** + * Swaps the {@link GLContext} of given {@link GLAutoDrawable} + * and {@link GLAutoDrawable#disposeGLEventListener(GLEventListener, boolean) disposes} * each {@link GLEventListener} w/o removing it. * <p> * The GL-Viewport is reset and {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape(..)} issued implicit. - * </p> + * </p> * <p> - * If an {@link GLAnimatorControl} is being attached to GLAutoDrawable src or dest and the current thread is different + * If an {@link GLAnimatorControl} is being attached to GLAutoDrawable src or dest and the current thread is different * than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation. * </p> * @param src * @param dest */ - public static final void swapGLContext(GLAutoDrawable src, GLAutoDrawable dest) { + public static final void swapGLContext(GLAutoDrawable src, GLAutoDrawable dest) { final GLAnimatorControl aAnim = src.getAnimator(); - final GLAnimatorControl bAnim = dest.getAnimator(); + final GLAnimatorControl bAnim = dest.getAnimator(); final boolean aIsPaused = isAnimatorAnimatingOnOtherThread(aAnim) && aAnim.pause(); final boolean bIsPaused = isAnimatorAnimatingOnOtherThread(bAnim) && bAnim.pause(); - + for(int i = src.getGLEventListenerCount() - 1; 0 <= i; i--) { src.disposeGLEventListener(src.getGLEventListener(i), false); } @@ -160,12 +160,12 @@ public class GLDrawableUtil { dest.disposeGLEventListener(dest.getGLEventListener(i), false); } dest.setContext( src.setContext( dest.getContext(), false ), false ); - + src.invoke(true, GLEventListenerState.setViewport); dest.invoke(true, GLEventListenerState.setViewport); - + if(aIsPaused) { aAnim.resume(); } if(bIsPaused) { bAnim.resume(); } } - + } |