aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsg215889 <[email protected]>2009-07-29 09:49:33 -0700
committersg215889 <[email protected]>2009-07-29 09:49:33 -0700
commit8883fa885e68cd21e8b8cd3343db0580913aebdf (patch)
tree3f2b97b0a5c32088290ad9702f15494b8ecd71dd
parentfdd78c172dfb76ba868359b359e344eaaf08d6f8 (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
-rw-r--r--doc/TODO.txt11
-rw-r--r--doxygen/doxygen-all-pub.cfg2
-rw-r--r--make/config/jogl/gl-if-CustomJavaCode-gl.java37
-rw-r--r--make/lsGL23toGL2ES1_commons.sh18
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java9
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java2
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java1
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java2
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java2
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java2
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java2
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java2
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java63
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java31
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java2
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java2
-rw-r--r--src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java6
-rw-r--r--src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java6
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java18
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Window.java6
-rw-r--r--src/newt/classes/com/sun/javafx/newt/opengl/GLWindow.java13
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java13
-rwxr-xr-xsrc/newt/native/BroadcomEGL.c17
23 files changed, 191 insertions, 76 deletions
diff --git a/doc/TODO.txt b/doc/TODO.txt
index 1fbb12616..8aa9e96ed 100644
--- a/doc/TODO.txt
+++ b/doc/TODO.txt
@@ -4,17 +4,6 @@ Random, somewhat old to-do list:
- Non-const array types must be properly released with JNI_COMMIT in
order to see side effects if the array was copied.
-- Figure out how to implement GLEventListener.displayChanged(bool,bool).
- I believe we need additional support in J2SE before this will be possible
- to detect and implement. The basic problem is that we need to find a way
- to determine when a GLCanvas has moved to a different
- display device, so we can re-load the GL function addresses using
- wgl/glXGetProcAddress. See comments at top of GLCanvas.java. Also need a
- way to determine with the display mode (e.g., bit depth) of the GLDrawable
- has changed. Once both of these problems are solved, we'll need to hook it
- into GLEventListener.displayChanged() and also be sure to reset the
- GLDrawable's glProcAddress table as appropriate.
-
- Think about e.g. protected access for Impl classes
- Fix glProgramStringARB and glGetProgramString{NV,ARB} so that they
diff --git a/doxygen/doxygen-all-pub.cfg b/doxygen/doxygen-all-pub.cfg
index cd8dfb6a0..8bf4685cb 100644
--- a/doxygen/doxygen-all-pub.cfg
+++ b/doxygen/doxygen-all-pub.cfg
@@ -460,7 +460,7 @@ WARN_LOGFILE =
# with spaces.
INPUT = ../src/jogl/classes/javax
-INPUT += ../build/jogl/gensrc/classes/javax
+INPUT += ../build-x86_64/jogl/gensrc/classes/javax
INPUT += ../src/jogl/classes/com/sun/opengl/util
INPUT += ../src/newt/classes/com/sun/javafx/newt
diff --git a/make/config/jogl/gl-if-CustomJavaCode-gl.java b/make/config/jogl/gl-if-CustomJavaCode-gl.java
index c5ce8d9a6..2bdc4e47c 100644
--- a/make/config/jogl/gl-if-CustomJavaCode-gl.java
+++ b/make/config/jogl/gl-if-CustomJavaCode-gl.java
@@ -1,4 +1,41 @@
+ /**
+ * The following enumeration are common in GL2ES1 and GL2GL3
+ */
+ public static final int GL_AND = 0x1501;
+ public static final int GL_AND_INVERTED = 0x1504;
+ public static final int GL_AND_REVERSE = 0x1502;
+ public static final int GL_BLEND_DST = 0x0BE0;
+ public static final int GL_BLEND_SRC = 0x0BE1;
+ public static final int GL_BUFFER_ACCESS = 0x88BB;
+ public static final int GL_CLEAR = 0x1500;
+ public static final int GL_COLOR_LOGIC_OP = 0x0BF2;
+ public static final int GL_COPY = 0x1503;
+ public static final int GL_COPY_INVERTED = 0x150C;
+ public static final int GL_DEPTH_COMPONENT24 = 0x81A6;
+ public static final int GL_DEPTH_COMPONENT32 = 0x81A7;
+ public static final int GL_EQUIV = 0x1509;
+ public static final int GL_LINE_SMOOTH = 0x0B20;
+ public static final int GL_LINE_SMOOTH_HINT = 0x0C52;
+ public static final int GL_LOGIC_OP_MODE = 0x0BF0;
+ public static final int GL_MULTISAMPLE = 0x809D;
+ public static final int GL_NAND = 0x150E;
+ public static final int GL_NOOP = 0x1505;
+ public static final int GL_NOR = 0x1508;
+ public static final int GL_OR = 0x1507;
+ public static final int GL_OR_INVERTED = 0x150D;
+ public static final int GL_OR_REVERSE = 0x150B;
+ public static final int GL_POINT_FADE_THRESHOLD_SIZE = 0x8128;
+ public static final int GL_POINT_SIZE = 0x0B11;
+ public static final int GL_SAMPLE_ALPHA_TO_ONE = 0x809F;
+ public static final int GL_SET = 0x150F;
+ public static final int GL_SMOOTH_LINE_WIDTH_RANGE = 0x0B22;
+ public static final int GL_SMOOTH_POINT_SIZE_RANGE = 0x0B12;
+ public static final int GL_STENCIL_INDEX1 = 0x8D46;
+ public static final int GL_STENCIL_INDEX4 = 0x8D47;
+ public static final int GL_WRITE_ONLY = 0x88B9;
+ public static final int GL_XOR = 0x1506;
+
public void glClearDepth( double depth );
public void glDepthRange(double zNear, double zFar);
diff --git a/make/lsGL23toGL2ES1_commons.sh b/make/lsGL23toGL2ES1_commons.sh
new file mode 100644
index 000000000..b91edb794
--- /dev/null
+++ b/make/lsGL23toGL2ES1_commons.sh
@@ -0,0 +1,18 @@
+#! /bin/sh
+
+BUILDDIR=$1
+shift
+if [ -z "$BUILDDIR" ] ; then
+ echo "usage $0 <BUILDDIR>"
+ exit 1
+fi
+
+idir=$BUILDDIR/jogl/gensrc/classes/javax/media/opengl
+
+echo GL2GL3 to GL2ES1 enums
+# sort $idir/GL2.java $idir/GL3.java $idir/GL2ES1.java $idir/GL2GL3.java | uniq -d | grep GL_ | awk ' { print $5 } '
+sort $idir/GL2.java $idir/GL3.java $idir/GL2ES1.java $idir/GL2GL3.java | uniq -d | grep GL_
+
+echo GL2GL3 to GL2ES1 functions
+# sort $idir/GL2.java $idir/GL3.java $idir/GL2ES1.java $idir/GL2GL3.java | uniq -d | grep "public [a-z0-9_]* gl"
+sort $idir/GL2.java $idir/GL3.java $idir/GL2ES1.java $idir/GL2GL3.java | uniq -d | grep "public [a-z0-9_]* gl"
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() {
}
}
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java b/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java
index c7d2acec0..48a04a3c9 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java
+++ b/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java
@@ -88,6 +88,12 @@ public class NullWindow implements NativeWindow {
return lockedStack;
}
+ public boolean surfaceSwap() {
+ return false;
+ }
+
+ public void surfaceUpdated() { }
+
public long getDisplayHandle() {
return displayHandle;
}
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java b/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java
index a4a529c54..5ad2804c1 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java
+++ b/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java
@@ -115,6 +115,12 @@ public abstract class JAWTWindow implements NativeWindow {
return lockedStack;
}
+ public boolean surfaceSwap() {
+ return false;
+ }
+
+ public void surfaceUpdated() { }
+
public long getDisplayHandle() {
return config.getScreen().getDevice().getHandle();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java
index 2a9782c12..6a588538d 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java
@@ -111,6 +111,24 @@ public interface NativeWindow {
*/
public Exception getLockedStack();
+ /**
+ * Provide a mechanism to utilize custom (pre-) swap surface
+ * code. This method is called before the render toolkit (e.g. JOGL)
+ * swaps the buffer/surface. The implementation may itself apply the swapping,
+ * in which case true shall be returned.
+ *
+ * @return true if this method completed swapping the surface,
+ * otherwise false, in which case eg the GLDrawable
+ * implementation has to swap the code.
+ */
+ public boolean surfaceSwap();
+
+ /**
+ * Method invoked after the render toolkit (e.g. JOGL)
+ * swapped/changed the buffer/surface.
+ */
+ public void surfaceUpdated();
+
/**
* render all native window information invalid,
* as if the native window was destroyed
diff --git a/src/newt/classes/com/sun/javafx/newt/Window.java b/src/newt/classes/com/sun/javafx/newt/Window.java
index a1168d12d..e2903bd62 100755
--- a/src/newt/classes/com/sun/javafx/newt/Window.java
+++ b/src/newt/classes/com/sun/javafx/newt/Window.java
@@ -269,6 +269,12 @@ public abstract class Window implements NativeWindow
y=0;
}
+ public boolean surfaceSwap() {
+ return false;
+ }
+
+ public void surfaceUpdated() {}
+
protected void clearEventMask() {
eventMask=0;
}
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/GLWindow.java b/src/newt/classes/com/sun/javafx/newt/opengl/GLWindow.java
index 8ecfe6216..7a7ff0859 100644
--- a/src/newt/classes/com/sun/javafx/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/sun/javafx/newt/opengl/GLWindow.java
@@ -654,6 +654,19 @@ public class GLWindow extends Window implements GLAutoDrawable {
return null;
}
+ public boolean surfaceSwap() {
+ if(null!=drawable) return drawable.getNativeWindow().surfaceSwap();
+ return super.surfaceSwap();
+ }
+
+ public void surfaceUpdated() {
+ if(null!=drawable) {
+ drawable.getNativeWindow().surfaceUpdated();
+ } else {
+ super.surfaceUpdated();
+ }
+ }
+
public long getWindowHandle() {
if(null!=drawable) return drawable.getNativeWindow().getWindowHandle();
return super.getWindowHandle();
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java
index 10e70baa0..ddee07c49 100755
--- a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java
+++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java
@@ -85,10 +85,10 @@ public class BCEGLWindow extends Window {
void setSizeImpl(int width, int height) {
if(0!=windowHandle) {
// n/a in BroadcomEGL
- System.err.println("setSize n/a in BroadcomEGL with realized window");
+ System.err.println("BCEGLWindow.setSizeImpl n/a in BroadcomEGL with realized window");
} else {
if(DEBUG_IMPLEMENTATION) {
- Exception e = new Exception("BCEGLWindow.setSize() "+this.width+"x"+this.height+" -> "+width+"x"+height);
+ Exception e = new Exception("BCEGLWindow.setSizeImpl() "+this.width+"x"+this.height+" -> "+width+"x"+height);
e.printStackTrace();
}
this.width = width;
@@ -107,6 +107,14 @@ public class BCEGLWindow extends Window {
return false;
}
+ public boolean surfaceSwap() {
+ if ( 0!=windowHandle ) {
+ SwapWindow(getDisplayHandle(), windowHandle);
+ return true;
+ }
+ return false;
+ }
+
//----------------------------------------------------------------------
// Internals only
//
@@ -114,6 +122,7 @@ public class BCEGLWindow extends Window {
protected static native boolean initIDs();
private native long CreateWindow(long eglDisplayHandle, boolean chromaKey, int width, int height);
private native void CloseWindow(long eglDisplayHandle, long eglWindowHandle);
+ private native void SwapWindow(long eglDisplayHandle, long eglWindowHandle);
private long realizeWindow(boolean chromaKey, int width, int height) {
diff --git a/src/newt/native/BroadcomEGL.c b/src/newt/native/BroadcomEGL.c
index 716f7d9ee..764fa9b16 100755
--- a/src/newt/native/BroadcomEGL.c
+++ b/src/newt/native/BroadcomEGL.c
@@ -51,10 +51,10 @@
typedef unsigned int GLuint;
-EGLDisplay EGLUtil_CreateDisplay( GLuint uiWidth, GLuint uiHeight );
+EGLDisplay EGLUtil_CreateDisplayByNative( GLuint uiWidth, GLuint uiHeight );
void EGLUtil_DestroyDisplay( EGLDisplay eglDisplay );
-EGLSurface EGLUtil_CreateWindow( EGLDisplay eglDisplay, /* bool */ GLuint bChromakey, GLuint *puiWidth, GLuint *puiHeight );
+EGLSurface EGLUtil_CreateWindowByNative( EGLDisplay eglDisplay, /* bool */ GLuint bChromakey, GLuint *puiWidth, GLuint *puiHeight );
void EGLUtil_DestroyWindow( EGLDisplay eglDisplay, EGLSurface eglSurface );
void EGLUtil_SwapWindow( EGLDisplay eglDisplay, EGLSurface eglSurface );
@@ -132,7 +132,6 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_Cre
}
window = EGLUtil_CreateWindowByNative( dpy, chromaKey, &uiWidth, &uiHeight );
- // EGLUtil_DestroyWindow( dpy, window );
if(NULL==window) {
fprintf(stderr, "[RealizeWindow.Create] failed: NULL\n");
@@ -161,10 +160,20 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_Cre
JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_CloseWindow
(JNIEnv *env, jobject obj, jlong display, jlong window)
{
- EGLDisplay dpy = (EGLDisplay)(intptr_t)display;
+ EGLDisplay dpy = (EGLDisplay) (intptr_t) display;
EGLSurface surf = (EGLSurface) (intptr_t) window;
EGLUtil_DestroyWindow(dpy, surf);
DBG_PRINT( "[CloseWindow]\n");
}
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_SwapWindow
+ (JNIEnv *env, jobject obj, jlong display, jlong window)
+{
+ EGLDisplay dpy = (EGLDisplay) (intptr_t) display;
+ EGLSurface surf = (EGLSurface) (intptr_t) window;
+ EGLUtil_SwapWindow( dpy, surf );
+
+ DBG_PRINT( "[SwapWindow]\n");
+}
+