diff options
author | sg215889 <[email protected]> | 2009-07-29 09:49:33 -0700 |
---|---|---|
committer | sg215889 <[email protected]> | 2009-07-29 09:49:33 -0700 |
commit | 8883fa885e68cd21e8b8cd3343db0580913aebdf (patch) | |
tree | 3f2b97b0a5c32088290ad9702f15494b8ecd71dd /src/jogl | |
parent | fdd78c172dfb76ba868359b359e344eaaf08d6f8 (diff) |
Fix: doxygen-all-pub.cfg; Add NativeWindow: surfaceSwap() and surfaceUpdated(); BroadcomEGL: Use custom surfaceSwap(); GLDrawableImpl's: Utilize NativeWindow's surfaceSwap() and surfaceUpdated(); Fix common enum of GL2ES1 and GL2GL3, merge them in GL
Diffstat (limited to 'src/jogl')
12 files changed, 62 insertions, 58 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java index c381f68f5..15ccc0f96 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java @@ -71,8 +71,17 @@ public abstract class GLDrawableImpl implements GLDrawable { } public void swapBuffers() throws GLException { + GLCapabilities caps = (GLCapabilities)component.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); + if (caps.getDoubleBuffered()) { + if(!component.surfaceSwap()) { + swapBuffersImpl(); + } + } + component.surfaceUpdated(); } + protected abstract void swapBuffersImpl(); + public static String toHexString(long hex) { return GLContextImpl.toHexString(hex); } diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java index c7c2bcab2..36117f059 100644 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java @@ -64,7 +64,7 @@ public class EGLOnscreenDrawable extends EGLDrawable { return surf; } - public void swapBuffers() throws GLException { + protected void swapBuffersImpl() { boolean didLock = false; try { if ( !isSurfaceLocked() ) { diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java index bcf3294c1..a792762a4 100644 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java @@ -118,5 +118,6 @@ public class EGLPbufferDrawable extends EGLDrawable { return new EGLPbufferContext(this, shareWith); } + protected void swapBuffersImpl() { } } diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java index f87cc150b..4a3e0a8eb 100644 --- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java @@ -102,7 +102,7 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext { } } - public void swapBuffers() throws GLException { + protected void swapBuffers() { if (!CGL.flushBuffer(nsContext)) { throw new GLException("Error swapping buffers"); } diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java index 98687b5ef..56951ae10 100644 --- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java @@ -78,7 +78,7 @@ public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable { return component.getHeight(); } - public void swapBuffers() throws GLException { + protected void swapBuffersImpl() { for (Iterator iter = createdContexts.iterator(); iter.hasNext(); ) { WeakReference ref = (WeakReference) iter.next(); MacOSXOnscreenCGLContext ctx = (MacOSXOnscreenCGLContext) ref.get(); diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java index 54101331d..0d031ffff 100644 --- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -87,7 +87,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { return pBuffer; } - public void swapBuffers() throws GLException { + protected void swapBuffersImpl() { // FIXME: do we need to do anything if the pbuffer is double-buffered? } diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java index ecd4e1685..71d82e784 100644 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java @@ -127,7 +127,7 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable { } } - public void swapBuffers() throws GLException { + protected void swapBuffersImpl() { } } diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java index 6a03406f9..f54e8f1a0 100644 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -107,7 +107,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { return floatMode; } - public void swapBuffers() throws GLException { + protected void swapBuffersImpl() { } private void createPbuffer(long parentHdc, WGLExt wglExt) { diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java index 3017d258b..01e259665 100644 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java @@ -82,44 +82,41 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { } } - public void swapBuffers() throws GLException { - GLCapabilities caps = (GLCapabilities)getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); - if (caps.getDoubleBuffered()) { - boolean didLock = false; + protected void swapBuffersImpl() { + boolean didLock = false; - try { - if ( !isSurfaceLocked() ) { - // Usually the surface shall be locked within [makeCurrent .. swap .. release] - if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) { - return; - } - didLock = true; + try { + if ( !isSurfaceLocked() ) { + // Usually the surface shall be locked within [makeCurrent .. swap .. release] + if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) { + return; } + didLock = true; + } - long startTime = 0; - if (PROFILING) { - startTime = System.currentTimeMillis(); - } + long startTime = 0; + if (PROFILING) { + startTime = System.currentTimeMillis(); + } - if (!WGL.SwapBuffers(getNativeWindow().getSurfaceHandle()) && (WGL.GetLastError() != 0)) { - throw new GLException("Error swapping buffers"); - } + if (!WGL.SwapBuffers(getNativeWindow().getSurfaceHandle()) && (WGL.GetLastError() != 0)) { + throw new GLException("Error swapping buffers"); + } - if (PROFILING) { - long endTime = System.currentTimeMillis(); - profilingSwapBuffersTime += (endTime - startTime); - int ticks = PROFILING_TICKS; - if (++profilingSwapBuffersTicks == ticks) { - System.err.println("SwapBuffers calls: " + profilingSwapBuffersTime + " ms / " + ticks + " calls (" + - ((float) profilingSwapBuffersTime / (float) ticks) + " ms/call)"); - profilingSwapBuffersTime = 0; - profilingSwapBuffersTicks = 0; - } - } - } finally { - if (didLock) { - unlockSurface(); - } + if (PROFILING) { + long endTime = System.currentTimeMillis(); + profilingSwapBuffersTime += (endTime - startTime); + int ticks = PROFILING_TICKS; + if (++profilingSwapBuffersTicks == ticks) { + System.err.println("SwapBuffers calls: " + profilingSwapBuffersTime + " ms / " + ticks + " calls (" + + ((float) profilingSwapBuffersTime / (float) ticks) + " ms/call)"); + profilingSwapBuffersTime = 0; + profilingSwapBuffersTicks = 0; + } + } + } finally { + if (didLock) { + unlockSurface(); } } } diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java index 738714ecb..1abc36c58 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java @@ -76,26 +76,23 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { } } - public void swapBuffers() throws GLException { - GLCapabilities caps = (GLCapabilities)getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); - if (caps.getDoubleBuffered()) { - boolean didLock = false; - try { - if ( !isSurfaceLocked() ) { - // Usually the surface shall be locked within [makeCurrent .. swap .. release] - if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) { - return; - } - didLock=true; + protected void swapBuffersImpl() { + boolean didLock = false; + try { + if ( !isSurfaceLocked() ) { + // Usually the surface shall be locked within [makeCurrent .. swap .. release] + if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) { + return; } + didLock=true; + } - GLX.glXSwapBuffers(component.getDisplayHandle(), component.getSurfaceHandle()); + GLX.glXSwapBuffers(component.getDisplayHandle(), component.getSurfaceHandle()); - } finally { - if(didLock) { - unlockSurface(); - } - } + } finally { + if(didLock) { + unlockSurface(); + } } } diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java index 51938df5f..768f6b8e8 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java @@ -133,6 +133,6 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable { getFactoryImpl().unlockToolkit(); } } - public void swapBuffers() throws GLException { + protected void swapBuffersImpl() { } } diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java index eecd92a53..bee24fa47 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java @@ -148,6 +148,6 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { return GLPbuffer.NV_FLOAT; } - public void swapBuffers() throws GLException { + protected void swapBuffersImpl() { } } |