aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-03-04 23:05:28 +0100
committerSven Gothel <[email protected]>2012-03-04 23:05:28 +0100
commita0177c8a1048683e5d43f4712f8f9e37091d4e85 (patch)
tree0d164b0a2fbeda187549f41e488be05f8666b726
parentaeca49c50789b42d991386ace3edd0c10d23acc2 (diff)
NEWT/GLWindow.display(): No explicit surface locking/unlocking for GLDrawableHelper.invokeGL(..) - it's done implicit at makeCurrent()/release()
The explicit locking takes away the locking result, eg. SURFACE_CHANGED, which is required to update the delegated drawable handles (e.g.: EGL surface handle). With the followup fix of EGLDrawable.updateHandle()'s recreate EGL surface, an EGL 'wrapper' can work on Windows (eg. ANGLE).
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java17
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableHelper.java7
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableImpl.java9
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java9
4 files changed, 28 insertions, 14 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 53b63cc0d..c039112c1 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -175,7 +175,7 @@ public abstract class GLContext {
/**
* Makes this GLContext current on the calling thread.
- *
+ * <p>
* There are two return values that indicate success and one that
* indicates failure. A return value of CONTEXT_CURRENT_NEW
* indicates that that context has been made current, and that
@@ -185,15 +185,22 @@ public abstract class GLContext {
* this case, the application may wish to initialize the state. A
* return value of CONTEXT_CURRENT indicates that the context has
* been made currrent, with its previous state restored.
- *
+ * </p>
+ * <p>
* If the context could not be made current (for example, because
* the underlying drawable has not ben realized on the display) ,
* a value of CONTEXT_NOT_CURRENT is returned.
- *
+ * </p>
+ * <p>
* If the context is in use by another thread at the time of the
* call, then if isSynchronized() is true the call will
* block. If isSynchronized() is false, an exception will be
* thrown and the context will remain current on the other thread.
+ * </p>
+ * <p>
+ * The drawable's surface is being locked at entry
+ * and unlocked at {@link #release()}
+ * </p>
*
* @return CONTEXT_CURRENT if the context was successfully made current
* @return CONTEXT_CURRENT_NEW if the context was successfully made
@@ -210,6 +217,10 @@ public abstract class GLContext {
/**
* Releases control of this GLContext from the current thread.
+ * <p>
+ * The drawable's surface is being unlocked at exit,
+ * assumed to be locked by {@link #makeCurrent()}.
+ * </p>
*
* @throws GLException if the context had not previously been made
* current on the current thread
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index 509839f55..c992b3cb2 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -335,8 +335,11 @@ public class GLDrawableHelper {
desired goal is to be able to implement GLAutoDrawable's in terms of
the GLContext's public APIs, and putting it into a separate
class helps ensure that we don't inadvertently use private
- methods of the GLContext or its implementing classes.<br>
- * <br>
+ methods of the GLContext or its implementing classes.
+ <p>
+ Note: Locking of the surface is implicit done by {@link GLContext#makeCurrent()},
+ where unlocking is performed by the latter {@link GLContext#release()}.
+ </p>
*
* @param drawable
* @param context
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
index 02a94f31c..ba64127d4 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
@@ -135,7 +135,12 @@ public abstract class GLDrawableImpl implements GLDrawable {
protected void destroyHandle() {}
/** called with locked surface @ setRealized(true) or @ lockSurface(..) when surface changed */
- protected void updateHandle() {}
+ protected void updateHandle() {
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": updateHandle: "+getClass().getSimpleName()+": "+this);
+ Thread.dumpStack();
+ }
+ }
public long getHandle() {
return surface.getSurfaceHandle();
@@ -148,7 +153,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
public final synchronized void setRealized(boolean realizedArg) {
if ( realized != realizedArg ) {
if(DEBUG) {
- System.err.println(getThreadName() + ": setRealized: "+getClass().getName()+" "+realized+" -> "+realizedArg);
+ System.err.println(getThreadName() + ": setRealized: "+getClass().getSimpleName()+" "+realized+" -> "+realizedArg);
}
realized = realizedArg;
AbstractGraphicsDevice aDevice = surface.getGraphicsConfiguration().getScreen().getDevice();
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index c0d79a5d4..156e479fd 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -555,13 +555,8 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC
}
if( null != context ) { // TODO: Check memory sync
- if( NativeSurface.LOCK_SURFACE_NOT_READY < lockSurface() ) {
- try {
- helper.invokeGL(drawable, context, displayAction, initAction);
- } finally {
- unlockSurface();
- }
- }
+ // surface is locked/unlocked implicit by context's makeCurrent/release
+ helper.invokeGL(drawable, context, displayAction, initAction);
}
}