summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java15
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java28
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java7
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java6
13 files changed, 27 insertions, 95 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
index a9cc40335..de10b066d 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
@@ -197,6 +197,16 @@ public abstract class EGLDrawable extends GLDrawableImpl {
}
}
+ protected final void swapBuffersImpl() {
+ // single-buffer is already filtered out @ GLDrawableImpl#swapBuffers()
+ if(!EGL.eglSwapBuffers(eglDisplay, eglSurface)) {
+ if(DEBUG) {
+ System.err.println("eglSwapBuffers failed:");
+ Thread.dumpStack();
+ }
+ }
+ }
+
public int getWidth() {
int[] tmp = new int[1];
if (!EGL.eglQuerySurface(eglDisplay, eglSurface, EGL.EGL_WIDTH, tmp, 0)) {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java
index 7d5e0448d..42f067b29 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java
@@ -55,15 +55,5 @@ public class EGLOnscreenDrawable extends EGLDrawable {
protected long createSurface(long eglDpy, long eglNativeCfg, long surfaceHandle) {
return EGL.eglCreateWindowSurface(eglDpy, eglNativeCfg, surfaceHandle, null);
}
-
- protected void swapBuffersImpl() {
- if(!EGL.eglSwapBuffers(eglDisplay, eglSurface)) {
- if(DEBUG) {
- System.err.println("eglSwapBuffers failed:");
- Thread.dumpStack();
- }
- }
- }
-
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java
index 5fb32e6cd..256007834 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java
@@ -97,11 +97,5 @@ public class EGLPbufferDrawable extends EGLDrawable {
public GLContext createContext(GLContext shareWith) {
return new EGLPbufferContext(this, shareWith);
}
-
- protected void swapBuffersImpl() {
- if(DEBUG) {
- System.err.println("unhandled swapBuffersImpl() called for: "+this);
- }
- }
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
index 08a531200..ba384fc71 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
@@ -48,7 +48,6 @@ import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
import jogamp.nativewindow.WrappedSurface;
import jogamp.opengl.GLContextShareSet;
@@ -61,7 +60,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
private MacOSXExternalCGLContext(Drawable drawable, boolean isNSContext, long handle) {
super(drawable, null);
setOpenGLMode(isNSContext ? GLBackendType.NSOPENGL : GLBackendType.CGL );
- drawable.setExternalCGLContext(this);
+ drawable.registerContext(this);
this.contextHandle = handle;
GLContextShareSet.contextCreated(this);
setGLFunctionAvailability(false, true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
@@ -150,16 +149,10 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
// Need to provide the display connection to extension querying APIs
static class Drawable extends MacOSXCGLDrawable {
- MacOSXExternalCGLContext extCtx;
-
Drawable(GLDrawableFactory factory, NativeSurface comp) {
super(factory, comp, true);
}
- void setExternalCGLContext(MacOSXExternalCGLContext externalContext) {
- extCtx = externalContext;
- }
-
public GLContext createContext(GLContext shareWith) {
throw new GLException("Should not call this");
}
@@ -175,11 +168,5 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
public void setSize(int width, int height) {
throw new GLException("Should not call this");
}
-
- protected void swapBuffersImpl() {
- if (extCtx != null) {
- extCtx.swapBuffers();
- }
- }
}
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
index 2e1c24d91..c1f793c0b 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
@@ -40,45 +40,21 @@
package jogamp.opengl.macosx.cgl;
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
import javax.media.nativewindow.NativeSurface;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable {
- private List<WeakReference<MacOSXCGLContext>> createdContexts = new ArrayList<WeakReference<MacOSXCGLContext>>();
protected MacOSXOnscreenCGLDrawable(GLDrawableFactory factory, NativeSurface component) {
super(factory, component, false);
}
public GLContext createContext(GLContext shareWith) {
- MacOSXOnscreenCGLContext ctx= new MacOSXOnscreenCGLContext(this, shareWith);
- // NOTE: we need to keep track of the created contexts in order to
- // implement swapBuffers() because of how Mac OS X implements its
- // OpenGL window interface
- synchronized (createdContexts) {
- createdContexts.add(new WeakReference<MacOSXCGLContext>(ctx));
- }
+ final MacOSXOnscreenCGLContext ctx= new MacOSXOnscreenCGLContext(this, shareWith);
+ registerContext(ctx);
return ctx;
}
- protected void swapBuffersImpl() {
- synchronized (createdContexts) {
- for (Iterator<WeakReference<MacOSXCGLContext>> iter = createdContexts.iterator(); iter.hasNext(); ) {
- WeakReference<MacOSXCGLContext> ref = iter.next();
- MacOSXCGLContext ctx = ref.get();
- if (ctx != null) {
- ctx.swapBuffers();
- } else {
- iter.remove();
- }
- }
- }
- }
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
index dd41be930..525134f1e 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -106,7 +106,9 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
}
public GLContext createContext(GLContext shareWith) {
- return new MacOSXPbufferCGLContext(this, shareWith);
+ final MacOSXPbufferCGLContext ctx = new MacOSXPbufferCGLContext(this, shareWith);
+ registerContext(ctx);
+ return ctx;
}
@Override
@@ -120,12 +122,6 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
return pBuffer;
}
- protected void swapBuffersImpl() {
- if(DEBUG) {
- System.err.println("unhandled swapBuffersImpl() called for: "+this);
- }
- }
-
protected void destroyPbuffer() {
if (this.pBuffer != 0) {
NativeSurface ns = getNativeSurface();
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
index afa4da2f8..aa5da9f2b 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
@@ -169,11 +169,4 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable {
((SurfaceChangeable)ns).setSurfaceHandle(0);
}
}
-
- protected void swapBuffersImpl() {
- if(DEBUG) {
- System.err.println("unhandled swapBuffersImpl() called for: "+this);
- }
- }
-
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
index 74aa57a94..e34301328 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
@@ -124,12 +124,6 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
return floatMode;
}
- protected void swapBuffersImpl() {
- if(DEBUG) {
- System.err.println("unhandled swapBuffersImpl() called for: "+this);
- }
- }
-
private void createPbuffer() {
WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
SharedResource sharedResource = ((WindowsWGLDrawableFactory)factory).getOrCreateSharedResource(config.getScreen().getDevice());
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
index 4ed9a00c3..fe446e8fe 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
@@ -41,6 +41,7 @@
package jogamp.opengl.windows.wgl;
import java.security.AccessController;
+
import javax.media.nativewindow.NativeSurface;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
@@ -74,7 +75,8 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
}
}
- protected void swapBuffersImpl() {
+ protected final void swapBuffersImpl() {
+ // single-buffer is already filtered out @ GLDrawableImpl#swapBuffers()
long startTime = 0;
if (PROFILING) {
startTime = System.currentTimeMillis();
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index cd22127a3..2c9d72fb3 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -442,7 +442,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
if(null==sr) {
throw new IllegalArgumentException("No shared resource for "+device);
}
- final List returnList = new ArrayList();
+ final List<GLDrawableImpl> returnList = new ArrayList<GLDrawableImpl>();
Runnable r = new Runnable() {
public void run() {
GLContext lastContext = GLContext.getCurrent();
@@ -451,7 +451,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
sr.context.makeCurrent();
try {
- GLDrawableImpl pbufferDrawable = new WindowsPbufferWGLDrawable(WindowsWGLDrawableFactory.this, target, sr);
+ GLDrawableImpl pbufferDrawable = new WindowsPbufferWGLDrawable(WindowsWGLDrawableFactory.this, target);
returnList.add(pbufferDrawable);
} finally {
sr.context.release();
@@ -462,7 +462,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
};
maybeDoSingleThreadedWorkaround(r);
- return (GLDrawableImpl) returnList.get(0);
+ return returnList.get(0);
}
/**
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java
index d2ce629df..d27b9a92b 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java
@@ -42,6 +42,7 @@ package jogamp.opengl.x11.glx;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
+
import jogamp.opengl.*;
public abstract class X11GLXDrawable extends GLDrawableImpl {
@@ -64,9 +65,10 @@ public abstract class X11GLXDrawable extends GLDrawableImpl {
}
}
- protected void swapBuffersImpl() {
- GLX.glXSwapBuffers(getNativeSurface().getDisplayHandle(), getHandle());
- }
+ protected final void swapBuffersImpl() {
+ // single-buffer is already filtered out @ GLDrawableImpl#swapBuffers()
+ GLX.glXSwapBuffers(getNativeSurface().getDisplayHandle(), getHandle());
+ }
//---------------------------------------------------------------------------
// Internals only below this point
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
index 8c276c097..77598e011 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
@@ -140,10 +140,4 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
// Floating-point pbuffers currently require NVidia hardware on X11
return GLPbuffer.NV_FLOAT;
}
-
- protected void swapBuffersImpl() {
- if(DEBUG) {
- System.err.println("unhandled swapBuffersImpl() called for: "+this);
- }
- }
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java
index 486196856..6ede6e13d 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java
@@ -132,10 +132,4 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable {
((SurfaceChangeable)ns).setSurfaceHandle(0);
display = 0;
}
-
- protected void swapBuffersImpl() {
- if(DEBUG) {
- System.err.println("unhandled swapBuffersImpl() called for: "+this);
- }
- }
}