summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-07-04 18:02:11 +0200
committerSven Gothel <[email protected]>2012-07-04 18:02:11 +0200
commit9b35c57425b0a5f6b789b9b43a62a8b64be51d86 (patch)
tree04a4e082e00fd4d313346aa8dfc2ce4e5d3ab145 /src/jogl/classes/com/jogamp/opengl
parenteed8508ae1132e5f45f788e9cb3f3d5a1050ac70 (diff)
GLAutoDrawable* refinement of abstraction / generalization - API Change!
- GLAutoDrawable (compat change - recompile): - 'void invoke(boolean wait, GLRunnable glRunnable)' -> 'boolean invoke(boolean wait, GLRunnable glRunnable)' Allows notifying caller whether the task has been executed or at least enqueued. - GLAutoDrawable add 'GLEventListener removeGLEventListener(int index)' - This allow one to remove a specific GLEventListener and reusing it (return value). - GLDrawableImpl remove 'destroy()' to favor 'setRealized(false)' - Using more common code of GLAutoDrawableBase, i.e. GLPbufferImpl can use defaultDestroyOp(). - Removes redundancy of methods - GLAutoDrawableBase/Delegate - better 'default' names to emphasize it's purpose, adding API doc - includes more generic functionality - defaultWindowDestroyNotify() - defaultDestroyOp() - TestGLAutoDrawableDelegateNEWT demonstrates a simple example w/ all window events handled. - Fix TestParenting01cSwingAWT's threading use (gl disturbance thread)
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java46
1 files changed, 25 insertions, 21 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
index 31b679077..62b496891 100644
--- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
+++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
@@ -107,7 +107,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
//private static final boolean useSWTThread = ThreadingImpl.getMode() != ThreadingImpl.WORKER;
/* GL Stuff */
- private final GLDrawableHelper drawableHelper = new GLDrawableHelper();
+ private final GLDrawableHelper helper = new GLDrawableHelper();
private volatile GLDrawable drawable; // volatile avoids locking all accessors. FIXME still need to sync destroy/display
private GLContext context;
@@ -130,7 +130,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
private final Runnable initAction = new Runnable() {
@Override
public void run() {
- drawableHelper.init(GLCanvas.this);
+ helper.init(GLCanvas.this);
}
};
@@ -143,10 +143,10 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
@Override
public void run() {
if (sendReshape) {
- drawableHelper.reshape(GLCanvas.this, 0, 0, getWidth(), getHeight());
+ helper.reshape(GLCanvas.this, 0, 0, getWidth(), getHeight());
sendReshape = false;
}
- drawableHelper.display(GLCanvas.this);
+ helper.display(GLCanvas.this);
}
};
@@ -154,7 +154,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
private final Runnable makeCurrentAndDisplayAction = new Runnable() {
@Override
public void run() {
- drawableHelper.invokeGL(drawable, context, displayAction, initAction);
+ helper.invokeGL(drawable, context, displayAction, initAction);
}
};
@@ -170,7 +170,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
private final Runnable makeCurrentAndSwapBuffersAction = new Runnable() {
@Override
public void run() {
- drawableHelper.invokeGL(drawable, context, swapBuffersAction, initAction);
+ helper.invokeGL(drawable, context, swapBuffersAction, initAction);
}
};
@@ -191,7 +191,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
private final Runnable disposeOnEDTGLAction = new Runnable() {
@Override
public void run() {
- drawableHelper.disposeGL(GLCanvas.this, drawable, context, postDisposeGLAction);
+ helper.disposeGL(GLCanvas.this, drawable, context, postDisposeGLAction);
}
};
@@ -266,7 +266,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
addPaintListener(new PaintListener() {
@Override
public void paintControl(final PaintEvent arg0) {
- if (!drawableHelper.isExternalAnimatorAnimating()) {
+ if (!helper.isExternalAnimatorAnimating()) {
display();
}
}
@@ -284,12 +284,12 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
@Override
public void addGLEventListener(final GLEventListener arg0) {
- drawableHelper.addGLEventListener(arg0);
+ helper.addGLEventListener(arg0);
}
@Override
public void addGLEventListener(final int arg0, final GLEventListener arg1) throws IndexOutOfBoundsException {
- drawableHelper.addGLEventListener(arg0, arg1);
+ helper.addGLEventListener(arg0, arg1);
}
/**
@@ -312,12 +312,12 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
@Override
public GLAnimatorControl getAnimator() {
- return drawableHelper.getAnimator();
+ return helper.getAnimator();
}
@Override
public boolean getAutoSwapBufferMode() {
- return drawableHelper.getAutoSwapBufferMode();
+ return helper.getAutoSwapBufferMode();
}
@Override
@@ -336,30 +336,34 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
}
@Override
- public void invoke(final boolean wait, final GLRunnable run) {
- /* Queue task for running during the next display(). */
- drawableHelper.invoke(this, wait, run);
+ public boolean invoke(final boolean wait, final GLRunnable run) {
+ return helper.invoke(this, wait, run);
}
@Override
public void removeGLEventListener(final GLEventListener arg0) {
- drawableHelper.removeGLEventListener(arg0);
+ helper.removeGLEventListener(arg0);
}
@Override
+ public GLEventListener removeGLEventListener(int index) throws IndexOutOfBoundsException {
+ return helper.removeGLEventListener(index);
+ }
+
+ @Override
public void setAnimator(final GLAnimatorControl arg0) throws GLException {
- drawableHelper.setAnimator(arg0);
+ helper.setAnimator(arg0);
}
@Override
public void setAutoSwapBufferMode(final boolean arg0) {
- drawableHelper.setAutoSwapBufferMode(arg0);
+ helper.setAutoSwapBufferMode(arg0);
}
@Override
public GLContext setContext(GLContext newCtx) {
final GLContext oldCtx = context;
- final boolean newCtxCurrent = drawableHelper.switchContext(drawable, oldCtx, newCtx, additionalCtxCreationFlags);
+ final boolean newCtxCurrent = helper.switchContext(drawable, oldCtx, newCtx, additionalCtxCreationFlags);
context=(GLContextImpl)newCtx;
if(newCtxCurrent) {
context.makeCurrent();
@@ -477,7 +481,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
if (Threading.isSingleThreaded() && !Threading.isOpenGLThread()) {
runInDesignatedGLThread(disposeOnEDTGLAction);
} else if (context.isCreated()) {
- drawableHelper.disposeGL(GLCanvas.this, drawable, context, postDisposeGLAction);
+ helper.disposeGL(GLCanvas.this, drawable, context, postDisposeGLAction);
}
}
@@ -537,7 +541,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
runInDesignatedGLThread(asyncAction);
} else {
/* Run in current thread... */
- drawableHelper.invokeGL(drawable, context, syncAction, initAction);
+ helper.invokeGL(drawable, context, syncAction, initAction);
}
}