diff options
author | Sven Gothel <[email protected]> | 2012-07-02 19:42:52 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-07-02 19:42:52 +0200 |
commit | eed8508ae1132e5f45f788e9cb3f3d5a1050ac70 (patch) | |
tree | e1eec83da8dee44392407b59672134109fc63b6f /src/jogl/classes/com/jogamp | |
parent | 08e3f9bff494a5366781328734e83ae0202696fa (diff) |
GLAutoDrawable: Refine API doc; Use new abstract impl. GLAutoDrawableBase (GLWindow, ..); Add new GLAutoDrawableDelegate.
- Refine API doc
- 'void setContext(GLContext)' -> 'GLContext setContext(GLContext)'
- Add note to createContext(GLContext) override
-Use new abstract impl. GLAutoDrawableBase, used by:
- GLWindow
- GLAutoDrawableDelegate
- GLPbufferImpl
- Add new GLAutoDrawableDelegate incl. unit test
Diffstat (limited to 'src/jogl/classes/com/jogamp')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java index 920e63421..31b679077 100644 --- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java +++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java @@ -117,7 +117,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { private final ProxySurface proxySurface; /* Construction parameters stored for GLAutoDrawable accessor methods */ - private int ctxCreationFlags = 0; + private int additionalCtxCreationFlags = 0; private final GLCapabilitiesImmutable glCapsRequested; @@ -327,7 +327,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { @Override public int getContextCreationFlags() { - return ctxCreationFlags; + return additionalCtxCreationFlags; } @Override @@ -357,16 +357,22 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { } @Override - public void setContext(final GLContext ctx) { - if (ctx instanceof GLContextImpl) { - ((GLContextImpl) ctx).setContextCreationFlags(ctxCreationFlags); + public GLContext setContext(GLContext newCtx) { + final GLContext oldCtx = context; + final boolean newCtxCurrent = drawableHelper.switchContext(drawable, oldCtx, newCtx, additionalCtxCreationFlags); + context=(GLContextImpl)newCtx; + if(newCtxCurrent) { + context.makeCurrent(); } - this.context = ctx; + return oldCtx; } @Override public void setContextCreationFlags(final int arg0) { - ctxCreationFlags = arg0; + additionalCtxCreationFlags = arg0; + if(null != context) { + context.setContextCreationFlags(additionalCtxCreationFlags); + } } @Override @@ -379,8 +385,13 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { } @Override - public GLContext createContext(final GLContext arg0) { - return (drawable != null) ? drawable.createContext(arg0) : null; + public GLContext createContext(final GLContext shareWith) { + if(drawable != null) { + final GLContext _ctx = drawable.createContext(shareWith); + _ctx.setContextCreationFlags(additionalCtxCreationFlags); + return _ctx; + } + return null; } @Override |