aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl/impl/GLPbufferImpl.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-07-17 06:13:24 +0000
committerKenneth Russel <[email protected]>2005-07-17 06:13:24 +0000
commit7e7e225eaf4fddb31152ab204bf1776f26079d40 (patch)
tree522044c1fb226235fa34b9d013945f320765edd8 /src/net/java/games/jogl/impl/GLPbufferImpl.java
parent9d28b7f7fffdaeee7353945000546cb73a00157b (diff)
Further context-related changes for the JSR-231 API. The GLContext
implementations on all platforms have been split into orthogonal GLDrawable and GLContext concepts. It is now possible to create more than one GLContet per GLDrawable (though this has not been tested yet). GLCanvas has been reimplemented in terms of GLDrawableFactory.getGLDrawable(). More functionality has been moved from GLDrawable to GLAutoDrawable. Reimplemented lazy sending of reshape GLEventListener events in GLCanvas and GLJPanel and deleted notion of deferred reshapes from GLDrawableHelper and elsewhere. Sharing of textures and display lists is now expressed in terms of GLContexts instead of GLDrawables. Still need to move pbuffer creation into GLDrawableFactory from the onscreen GLContext implementations. Added option to gleem ExaminerViewer to disable automatic redraws upon mouse events and respecified more of gleem to work on GLAutoDrawables rather than GLDrawables. Updated all JOGL demos to work with new APIs and slightly different initialization sequences (in particular, for pbuffers -- this will change with the addition of GLDrawableFactory.createGLPbuffer()). git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@324 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/jogl/impl/GLPbufferImpl.java')
-rw-r--r--src/net/java/games/jogl/impl/GLPbufferImpl.java61
1 files changed, 35 insertions, 26 deletions
diff --git a/src/net/java/games/jogl/impl/GLPbufferImpl.java b/src/net/java/games/jogl/impl/GLPbufferImpl.java
index 4e8bd7c63..6e83f0d0e 100644
--- a/src/net/java/games/jogl/impl/GLPbufferImpl.java
+++ b/src/net/java/games/jogl/impl/GLPbufferImpl.java
@@ -52,20 +52,24 @@ import net.java.games.jogl.*;
interface so can be interacted with via its display() method. */
public class GLPbufferImpl implements GLPbuffer {
- // GLPbufferContext
+ private GLDrawableImpl pbufferDrawable;
private GLContextImpl context;
private GLDrawableHelper drawableHelper = new GLDrawableHelper();
private boolean isInitialized=false;
private int floatMode;
- public GLPbufferImpl(GLContext context) {
- this.context = (GLContextImpl) context;
+ public GLPbufferImpl(GLDrawableImpl pbufferDrawable,
+ GLContext parentContext) {
+ this.pbufferDrawable = pbufferDrawable;
+ context = (GLContextImpl) pbufferDrawable.createContext(parentContext);
+ context.setSynchronized(true);
}
- public void display() {
- maybeDoSingleThreadedWorkaround(displayOnEventDispatchThreadAction,
- displayAction,
- false);
+ public GLContext createContext(GLContext shareWith) {
+ return pbufferDrawable.createContext(shareWith);
+ }
+
+ public void setRealized(boolean realized) {
}
public void setSize(int width, int height) {
@@ -74,13 +78,17 @@ public class GLPbufferImpl implements GLPbuffer {
}
public int getWidth() {
- // FIXME
- throw new GLException("Not yet implemented");
+ return pbufferDrawable.getWidth();
}
public int getHeight() {
- // FIXME
- throw new GLException("Not yet implemented");
+ return pbufferDrawable.getHeight();
+ }
+
+ public void display() {
+ maybeDoSingleThreadedWorkaround(displayOnEventDispatchThreadAction,
+ displayAction,
+ false);
}
public void addGLEventListener(GLEventListener listener) {
@@ -91,6 +99,14 @@ public class GLPbufferImpl implements GLPbuffer {
drawableHelper.removeGLEventListener(listener);
}
+ public GLContext getContext() {
+ return context;
+ }
+
+ public GLDrawable getDrawable() {
+ return pbufferDrawable;
+ }
+
public GL getGL() {
return context.getGL();
}
@@ -108,11 +124,11 @@ public class GLPbufferImpl implements GLPbuffer {
}
public void setAutoSwapBufferMode(boolean onOrOff) {
- context.setAutoSwapBufferMode(onOrOff);
+ drawableHelper.setAutoSwapBufferMode(onOrOff);
}
public boolean getAutoSwapBufferMode() {
- return context.getAutoSwapBufferMode();
+ return drawableHelper.getAutoSwapBufferMode();
}
public void swapBuffers() {
@@ -141,15 +157,6 @@ public class GLPbufferImpl implements GLPbuffer {
context.releasePbufferFromTexture();
}
- public GLContext getContext() {
- return context;
- }
-
- // FIXME: workaround for problems with deferring reshape actions
- public GLDrawableHelper getDrawableHelper() {
- return drawableHelper;
- }
-
//----------------------------------------------------------------------
// No-ops for ComponentEvents
//
@@ -188,6 +195,7 @@ public class GLPbufferImpl implements GLPbuffer {
public void destroy() {
context.destroy();
+ pbufferDrawable.destroy();
}
public int getFloatingPointMode() {
@@ -221,7 +229,7 @@ public class GLPbufferImpl implements GLPbuffer {
throw new GLException(e);
}
} else {
- drawableHelper.invokeGL(context, invokeGLAction, isReshape, initAction);
+ drawableHelper.invokeGL(pbufferDrawable, context, invokeGLAction, initAction);
}
}
@@ -242,8 +250,9 @@ public class GLPbufferImpl implements GLPbuffer {
private DisplayAction displayAction = new DisplayAction();
class SwapBuffersAction implements Runnable {
+ // FIXME: currently a no-op
public void run() {
- context.swapBuffers();
+ pbufferDrawable.swapBuffers();
}
}
private SwapBuffersAction swapBuffersAction = new SwapBuffersAction();
@@ -253,14 +262,14 @@ public class GLPbufferImpl implements GLPbuffer {
// being resized on the AWT event dispatch thread
class DisplayOnEventDispatchThreadAction implements Runnable {
public void run() {
- drawableHelper.invokeGL(context, displayAction, false, initAction);
+ drawableHelper.invokeGL(pbufferDrawable, context, displayAction, initAction);
}
}
private DisplayOnEventDispatchThreadAction displayOnEventDispatchThreadAction =
new DisplayOnEventDispatchThreadAction();
class SwapBuffersOnEventDispatchThreadAction implements Runnable {
public void run() {
- drawableHelper.invokeGL(context, swapBuffersAction, false, initAction);
+ drawableHelper.invokeGL(pbufferDrawable, context, swapBuffersAction, initAction);
}
}
private SwapBuffersOnEventDispatchThreadAction swapBuffersOnEventDispatchThreadAction =