diff options
Diffstat (limited to 'src/jogl/classes/javax')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLCanvas.java | 23 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLJPanel.java | 11 |
2 files changed, 30 insertions, 4 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index 4ac21204f..c165a4833 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -315,6 +315,12 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable { } if(null!=context) { + boolean animatorWasAnimating = false; + GLAnimatorControl animator = getAnimator(); + if(null!=animator) { + animatorWasAnimating = animator.isAnimating(); + } + disposeRegenerate=regenerate; if (Threading.isSingleThreaded() && @@ -336,6 +342,10 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable { } else if(context.isCreated()) { drawableHelper.invokeGL(drawable, context, disposeAction, null); } + + if(regenerate && animatorWasAnimating && animator.isPaused()) { + animator.resume(); + } } if(DEBUG) { @@ -420,9 +430,15 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable { if(null==awtConfig) { throw new GLException("Error: AWTGraphicsConfiguration is null"); } - drawable = GLDrawableFactory.getFactory(glProfile).createGLDrawable(NativeWindowFactory.getNativeWindow(this, awtConfig)); - context = (GLContextImpl) drawable.createContext(shareWith); - context.setSynchronized(true); + // awtConfig.getScreen().getDevice().lock(); + try { + drawable = GLDrawableFactory.getFactory(glProfile).createGLDrawable(NativeWindowFactory.getNativeWindow(this, awtConfig)); + context = (GLContextImpl) drawable.createContext(shareWith); + context.setSynchronized(true); + drawable.setRealized(true); + } finally { + // awtConfig.getScreen().getDevice().unlock(); + } } finally { NativeWindowFactory.getDefaultToolkitLock().unlock(); } @@ -430,7 +446,6 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable { if(DEBUG) { System.err.println("Created Drawable: "+drawable); } - drawable.setRealized(true); } } diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 192695955..10aeefaf5 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -213,7 +213,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { Exception ex1 = new Exception("Info: dispose("+regenerate+") - start"); ex1.printStackTrace(); } + if (backend != null) { + boolean animatorWasAnimating = false; + GLAnimatorControl animator = getAnimator(); + if(null!=animator) { + animatorWasAnimating = animator.isAnimating(); + } + disposeRegenerate=regenerate; disposeContext=backend.getContext(); disposeDrawable=backend.getDrawable(); @@ -242,6 +249,10 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { if(null==disposeContext) { isInitialized = false; } + + if(regenerate && animatorWasAnimating && animator.isPaused()) { + animator.resume(); + } } if(DEBUG) { |