summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/GLContextImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLContextImpl.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index fd34d8ac4..9611a1651 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -458,7 +458,17 @@ public abstract class GLContextImpl extends GLContext {
if (!isCreated()) {
GLProfile.initProfiles(
getGLDrawable().getNativeSurface().getGraphicsConfiguration().getScreen().getDevice());
- newCreated = createImpl(); // may throws exception if fails!
+ final GLContextImpl shareWith = (GLContextImpl) GLContextShareSet.getShareContext(this);
+ if (null != shareWith) {
+ shareWith.getDrawableImpl().lockSurface();
+ }
+ try {
+ newCreated = createImpl(shareWith); // may throws exception if fails!
+ } finally {
+ if (null != shareWith) {
+ shareWith.getDrawableImpl().unlockSurface();
+ }
+ }
if (DEBUG) {
if(newCreated) {
System.err.println(getThreadName() + ": !!! Create GL context OK: " + toHexString(contextHandle) + " for " + getClass().getName());
@@ -485,7 +495,7 @@ public abstract class GLContextImpl extends GLContext {
}
}
protected abstract void makeCurrentImpl(boolean newCreatedContext) throws GLException;
- protected abstract boolean createImpl() throws GLException ;
+ protected abstract boolean createImpl(GLContextImpl sharedWith) throws GLException ;
/**
* Platform dependent but harmonized implementation of the <code>ARB_create_context</code>