aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-12-16 07:47:04 +0100
committerSven Gothel <[email protected]>2012-12-16 07:47:04 +0100
commite92823cddc54b0f4fa71e234061a21de6ee5248c (patch)
treeeaee49829bbaa1dd2fe4e073f00eb8e20caeb81d /src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
parent74c254d42bb2389dc9bf257898053700c8c72568 (diff)
GLJPanel: Impl. is GLProfile agnostic; Use GLDrawableFactory.createOffscreenDrawable(..) for common OffscreenBackend (dropping pbuffer/software); Flip FBO w/ GLSL texture renderer.
- Implementation is GLProfile agnostic - Shall work on ES2, GL2, .. etc - Use GLDrawableFactory.createOffscreenDrawable(..) for common OffscreenBackend (dropping pbuffer/software) - Leave offscreen selection to common factory code, favoring FBO - Flip FBO w/ GLSL texture renderer - Faster on low CPU machines - Enabled if GL2ES2 and FBO offscreen
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLDrawableHelper.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableHelper.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index 0f8b6b816..dc5d50cf2 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -398,7 +398,7 @@ public class GLDrawableHelper {
* </p>
* <p>
* Please consider using {@link #disposeAllGLEventListener(GLAutoDrawable, GLContext, boolean)}
- * or {@link #disposeGL(GLAutoDrawable, GLContext)}
+ * or {@link #disposeGL(GLAutoDrawable, GLContext, boolean)}
* for correctness, i.e. encapsulating all calls w/ makeCurrent etc.
* </p>
* @param autoDrawable
@@ -826,12 +826,16 @@ public class GLDrawableHelper {
/**
* Principal helper method which runs
* {@link #disposeAllGLEventListener(GLAutoDrawable, boolean) disposeAllGLEventListener(autoDrawable, false)}
- * with the context made current <b>and</b> destroys the context afterwards while holding the lock.
+ * with the context made current.
+ * <p>
+ * If <code>destroyContext</code> is <code>true</code> the context is destroyed in the end while holding the lock.<br/>
+ * </p>
* @param autoDrawable
* @param context
+ * @param destroyContext destroy context in the end while holding the lock
*/
public final void disposeGL(final GLAutoDrawable autoDrawable,
- final GLContext context) {
+ final GLContext context, boolean destroyContext) {
// Support for recursive makeCurrent() calls as well as calling
// other drawables' display() methods from within another one's
GLContext lastContext = GLContext.getCurrent();
@@ -858,7 +862,11 @@ public class GLDrawableHelper {
}
} finally {
try {
- context.destroy();
+ if(destroyContext) {
+ context.destroy();
+ } else {
+ context.release();
+ }
flushGLRunnables();
} catch (Exception e) {
System.err.println("Catched: "+e.getMessage());