From 90beaae660222f1fb5ca15313f8e4645d3fd30fe Mon Sep 17 00:00:00 2001 From: Morris Meyer Date: Mon, 27 Jul 2009 14:06:41 -0400 Subject: mips changes --- src/newt/classes/com/sun/javafx/newt/Display.java | 3 +- .../classes/com/sun/javafx/newt/NewtFactory.java | 3 + .../com/sun/javafx/newt/opengl/egl/EGLDisplay.java | 85 ++++++++++++++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 src/newt/classes/com/sun/javafx/newt/opengl/egl/EGLDisplay.java (limited to 'src/newt/classes/com/sun/javafx') diff --git a/src/newt/classes/com/sun/javafx/newt/Display.java b/src/newt/classes/com/sun/javafx/newt/Display.java index 5032477c9..bdac08dab 100755 --- a/src/newt/classes/com/sun/javafx/newt/Display.java +++ b/src/newt/classes/com/sun/javafx/newt/Display.java @@ -45,7 +45,8 @@ public abstract class Display implements Runnable { { Class displayClass = null; if (NativeWindowFactory.TYPE_EGL.equals(type)) { - displayClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDDisplay"); + // displayClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDDisplay"); + displayClass = Class.forName("com.sun.javafx.newt.opengl.egl.EGLDisplay"); } else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) { displayClass = Class.forName("com.sun.javafx.newt.windows.WindowsDisplay"); } else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) { diff --git a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java b/src/newt/classes/com/sun/javafx/newt/NewtFactory.java index b5a555455..b88e1e49e 100755 --- a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java +++ b/src/newt/classes/com/sun/javafx/newt/NewtFactory.java @@ -50,6 +50,7 @@ public abstract class NewtFactory { * Create a Display entity, incl native creation */ public static Display createDisplay(String name) { + System.out.println("NewtFactory: NAME: " + name); return Display.create(NativeWindowFactory.getNativeWindowType(true), name); } @@ -57,6 +58,8 @@ public abstract class NewtFactory { * Create a Display entity using the given implementation type, incl native creation */ public static Display createDisplay(String type, String name) { + System.out.println("NewtFactory: TYPE: " + type); + System.out.println("NewtFactory: NAME: " + name); return Display.create(type, name); } diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/egl/EGLDisplay.java b/src/newt/classes/com/sun/javafx/newt/opengl/egl/EGLDisplay.java new file mode 100644 index 000000000..bebb7ccf2 --- /dev/null +++ b/src/newt/classes/com/sun/javafx/newt/opengl/egl/EGLDisplay.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + */ + +package com.sun.javafx.newt.opengl.egl; + +import com.sun.javafx.newt.*; +import com.sun.javafx.newt.impl.*; +import com.sun.opengl.impl.egl.*; +import javax.media.nativewindow.*; +import javax.media.nativewindow.egl.*; + +public class EGLDisplay extends Display { + + static { + NativeLibLoader.loadNEWT(); + + System.loadLibrary("EglUtil"); + } + + public static void initSingleton() { + // just exist to ensure static init has been run + } + + + public EGLDisplay() { + } + + protected void createNative() { + try { + int windowWidth = 1920, windowHeight = 1080; + int width[] = { windowWidth }; + int height[] = { windowHeight }; + long eglDisplayHandle = + EGL.EGLUtil_CreateDisplayByNative(windowWidth, windowHeight); + long eglSurfaceHandle = + EGL.EGLUtil_CreateWindowByNative(eglDisplayHandle, 1, + width, 0, height, 0); + } catch (Throwable th) { + th.printStackTrace(); + } + } + + protected void closeNative() { + if (aDevice.getHandle() != EGL.EGL_NO_DISPLAY) { + EGL.eglTerminate(aDevice.getHandle()); + } + } + + protected void dispatchMessages() { + DispatchMessages(); + } + + private native void DispatchMessages(); +} + -- cgit v1.2.3 From 8949675c20e3fc064d170b509391fadbdb970611 Mon Sep 17 00:00:00 2001 From: sg215889 Date: Mon, 27 Jul 2009 19:25:33 -0700 Subject: Add Custom NativeWindow Type 'BroadcomEGL' (-Dnativewindow.ws.name=BroadcomEGL): 1st Draft of supporting broadcom's proprietary EGL mapping --- make/build-jogl.xml | 39 +---- make/build-nativewindow.xml | 15 +- make/build-newt.xml | 65 ++++++-- make/config/jogl/eglext.cfg | 3 - make/make.jogl.all.linux-x86.sh | 10 +- make/make.jogl.all.linux-x86_64.sh | 13 +- make/stub_includes/egl/EGL/egl.h | 5 - .../com/sun/opengl/impl/egl/EGLDrawable.java | 38 +++-- .../opengl/impl/egl/EGLGraphicsConfiguration.java | 19 ++- .../media/nativewindow/NativeWindowFactory.java | 4 +- src/newt/classes/com/sun/javafx/newt/Display.java | 7 +- .../classes/com/sun/javafx/newt/NewtFactory.java | 5 +- src/newt/classes/com/sun/javafx/newt/Screen.java | 2 + src/newt/classes/com/sun/javafx/newt/Window.java | 2 + .../javafx/newt/opengl/broadcom/BCEGLDisplay.java | 82 ++++++++++ .../javafx/newt/opengl/broadcom/BCEGLScreen.java | 64 ++++++++ .../javafx/newt/opengl/broadcom/BCEGLWindow.java | 126 +++++++++++++++ .../com/sun/javafx/newt/opengl/egl/EGLDisplay.java | 85 ----------- src/newt/native/BroadcomEGL.c | 170 +++++++++++++++++++++ src/newt/native/KDWindow.c | 18 +-- 20 files changed, 578 insertions(+), 194 deletions(-) create mode 100644 src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java create mode 100755 src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLScreen.java create mode 100755 src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java delete mode 100644 src/newt/classes/com/sun/javafx/newt/opengl/egl/EGLDisplay.java create mode 100755 src/newt/native/BroadcomEGL.c (limited to 'src/newt/classes/com/sun/javafx') diff --git a/make/build-jogl.xml b/make/build-jogl.xml index 348dc0624..fda65c5b2 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -1199,16 +1199,9 @@ - + - - - - - - - @@ -1293,8 +1286,6 @@ - - @@ -1302,8 +1293,6 @@ - - @@ -1311,8 +1300,6 @@ - - @@ -1320,8 +1307,6 @@ - - @@ -1329,23 +1314,15 @@ - - - - - + - - @@ -1354,8 +1331,6 @@ - - @@ -1364,8 +1339,6 @@ - - @@ -1373,8 +1346,6 @@ - - @@ -1382,8 +1353,6 @@ - - @@ -1394,8 +1363,6 @@ - - @@ -1554,7 +1521,7 @@ - + diff --git a/make/build-nativewindow.xml b/make/build-nativewindow.xml index e583d05a6..641e2a4f5 100644 --- a/make/build-nativewindow.xml +++ b/make/build-nativewindow.xml @@ -490,6 +490,8 @@ + + @@ -531,35 +533,30 @@ - - - - - @@ -568,7 +565,6 @@ - @@ -576,7 +572,6 @@ - @@ -584,21 +579,18 @@ - - - @@ -608,7 +600,6 @@ - @@ -749,7 +740,7 @@ + linker.cfg.id="${linker.cfg.id.base}"/> diff --git a/make/build-newt.xml b/make/build-newt.xml index 31a23172a..95869546f 100644 --- a/make/build-newt.xml +++ b/make/build-newt.xml @@ -97,16 +97,13 @@ - - - - + @@ -118,7 +115,9 @@ + + @@ -135,7 +134,10 @@ value="com/sun/javafx/newt/macosx/*"/> + value="com/sun/javafx/newt/opengl/*, com/sun/javafx/newt/opengl/kd/*"/> + + @@ -148,7 +150,7 @@ + value="${java.part.opengl} ${java.part.broadcomegl}"> @@ -271,6 +273,7 @@ + @@ -279,6 +282,7 @@ + @@ -308,6 +312,7 @@ + @@ -364,7 +369,13 @@ + + + + + + @@ -421,7 +432,19 @@ - + + + + + + + + + + + + + @@ -521,6 +544,7 @@ + @@ -553,7 +577,8 @@ - + + @@ -583,16 +608,20 @@ - + + + + + - - - + + + - + + + + @@ -693,6 +726,10 @@ + + + @@ -735,7 +772,7 @@ + includes="${java.part.core} ${java.part.opengl} ${java.part.broadcomegl}"/> diff --git a/make/config/jogl/eglext.cfg b/make/config/jogl/eglext.cfg index 0447dd1e4..bdd9a3655 100755 --- a/make/config/jogl/eglext.cfg +++ b/make/config/jogl/eglext.cfg @@ -124,6 +124,3 @@ Ignore eglTerminate Ignore eglWaitClient Ignore eglWaitGL Ignore eglWaitNative - -Ignore EGLUtil_CreateDisplayByNative -Ignore EGLUtil_CreateWindowByNative diff --git a/make/make.jogl.all.linux-x86.sh b/make/make.jogl.all.linux-x86.sh index 915bacaf3..8842cbc0c 100644 --- a/make/make.jogl.all.linux-x86.sh +++ b/make/make.jogl.all.linux-x86.sh @@ -9,15 +9,17 @@ fi # -Dc.compiler.debug=true # -DuseOpenMAX=true \ # -Dbuild.noarchives=true +# -Dgluegen.cpptasks.detected.os=true \ +# -DisUnix=true \ +# -DisLinux=true \ +# -DisLinuxX86=true \ ant \ -Dbuild.noarchives=true \ -Djogl.cg=1 -Dx11.cg.lib=../../lib-linux-x86 \ -Drootrel.build=build-x86 \ - -Dgluegen.cpptasks.detected.os=true \ - -DisUnix=true \ - -DisLinux=true \ - -DisLinuxX86=true \ + -Dos.arch=x86 \ -DisX11=true \ + -DuseKD=true \ -DuseOpenMAX=true \ $* 2>&1 | tee make.jogl.all.linux-x86.log diff --git a/make/make.jogl.all.linux-x86_64.sh b/make/make.jogl.all.linux-x86_64.sh index b9e1d1789..90883f97c 100644 --- a/make/make.jogl.all.linux-x86_64.sh +++ b/make/make.jogl.all.linux-x86_64.sh @@ -8,14 +8,17 @@ fi # -Dc.compiler.debug=true # -Dbuild.noarchives=true +# -Dgluegen.cpptasks.detected.os=true \ +# -DisUnix=true \ +# -DisLinux=true \ +# -DisLinuxAMD64=true \ +# -DisX11=true \ + ant \ -Dbuild.noarchives=true \ -Djogl.cg=1 -Dx11.cg.lib=../../lib-linux-x86_64 \ -Dc.compiler.debug=true \ -Drootrel.build=build-x86_64 \ - -Dgluegen.cpptasks.detected.os=true \ - -DisUnix=true \ - -DisLinux=true \ - -DisLinuxAMD64=true \ - -DisX11=true \ + -DuseKD=true \ + -DuseOpenMAX=true \ $* 2>&1 | tee make.jogl.all.linux-x86_64.log diff --git a/make/stub_includes/egl/EGL/egl.h b/make/stub_includes/egl/EGL/egl.h index 5b4c4215c..86ca4818f 100755 --- a/make/stub_includes/egl/EGL/egl.h +++ b/make/stub_includes/egl/EGL/egl.h @@ -297,11 +297,6 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); -EGLAPI EGLDisplay EGLAPIENTRY EGLUtil_CreateDisplayByNative(EGLint w, EGLint h); - -EGLAPI EGLSurface EGLAPIENTRY EGLUtil_CreateWindowByNative(EGLDisplay dpy, EGLint xx, - EGLint *wvalue, EGLint *hvalue); - typedef void (* EGLAPIENTRY __EGLFuncPtr)(void); EGLAPI __EGLFuncPtr eglGetProcAddress(const char *procname); diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java index d2907c83d..aabc6f263 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java @@ -45,10 +45,10 @@ import javax.media.opengl.*; public abstract class EGLDrawable extends GLDrawableImpl { protected boolean ownEGLDisplay = false; + protected boolean ownEGLSurface = false; private EGLGraphicsConfiguration eglConfig; protected long eglDisplay; protected long eglSurface; - private int[] tmp = new int[1]; protected EGLDrawable(EGLDrawableFactory factory, NativeWindow component) throws GLException { @@ -78,13 +78,16 @@ public abstract class EGLDrawable extends GLDrawableImpl { protected abstract long createSurface(long eglDpy, _EGLConfig eglNativeCfg); private void recreateSurface() { - if(EGL.EGL_NO_SURFACE!=eglSurface) { - EGL.eglDestroySurface(eglDisplay, eglSurface); - } - eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig()); + if(ownEGLSurface) { + // create a new EGLSurface .. + if(EGL.EGL_NO_SURFACE!=eglSurface) { + EGL.eglDestroySurface(eglDisplay, eglSurface); + } + eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig()); - if(DEBUG) { - System.err.println("setSurface using component: handle 0x"+Long.toHexString(component.getWindowHandle())+" -> 0x"+Long.toHexString(eglSurface)); + if(DEBUG) { + System.err.println("setSurface using component: handle 0x"+Long.toHexString(component.getWindowHandle())+" -> 0x"+Long.toHexString(eglSurface)); + } } } @@ -110,13 +113,28 @@ public abstract class EGLDrawable extends GLDrawableImpl { if (null == eglConfig) { throw new GLException("Null EGLGraphicsConfiguration from "+aConfig); } - eglConfig.updateGraphicsConfiguration(); + int[] tmp = new int[1]; + if (EGL.eglQuerySurface(eglDisplay, component.getWindowHandle(), EGL.EGL_CONFIG_ID, tmp, 0)) { + // component holds static EGLSurface + eglSurface = component.getWindowHandle(); + if(DEBUG) { + System.err.println("setSurface re-using component's EGLSurface: handle 0x"+Long.toHexString(eglSurface)); + } + } else { + // EGLSurface is ours .. + ownEGLSurface=true; + + eglConfig.updateGraphicsConfiguration(); + } } else { throw new GLException("EGLGraphicsConfiguration doesn't carry a EGLGraphicsDevice: "+aConfig); } } else { // create a new EGL config .. ownEGLDisplay=true; + // EGLSurface is ours .. + ownEGLSurface=true; + long nDisplay; if( NativeWindowFactory.TYPE_WINDOWS.equals(NativeWindowFactory.getNativeWindowType(false)) ) { nDisplay = component.getSurfaceHandle(); // don't even ask .. @@ -153,7 +171,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { } finally { unlockSurface(); } - } else if (eglSurface != EGL.EGL_NO_SURFACE) { + } else if (ownEGLSurface && eglSurface != EGL.EGL_NO_SURFACE) { // Destroy the window surface if (!EGL.eglDestroySurface(eglDisplay, eglSurface)) { throw new GLException("Error destroying window surface (eglDestroySurface)"); @@ -168,6 +186,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { } public int getWidth() { + int[] tmp = new int[1]; if (!EGL.eglQuerySurface(eglDisplay, eglSurface, EGL.EGL_WIDTH, tmp, 0)) { throw new GLException("Error querying surface width"); } @@ -175,6 +194,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { } public int getHeight() { + int[] tmp = new int[1]; if (!EGL.eglQuerySurface(eglDisplay, eglSurface, EGL.EGL_HEIGHT, tmp, 0)) { throw new GLException("Error querying surface height"); } diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java index 4f04bb57a..08fbae5bc 100644 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java @@ -37,6 +37,7 @@ package com.sun.opengl.impl.egl; import java.util.*; import javax.media.nativewindow.*; +import javax.media.nativewindow.egl.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.gluegen.runtime.NativeLibrary; @@ -52,15 +53,29 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple return configID; } - public EGLGraphicsConfiguration(AbstractGraphicsScreen screen, + public EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen, GLCapabilities capsChosen, GLCapabilities capsRequested, GLCapabilitiesChooser chooser, _EGLConfig cfg, int cfgID) { - super(screen, capsChosen, capsRequested); + super(absScreen, capsChosen, capsRequested); this.chooser = chooser; _config = cfg; configID = cfgID; } + public static EGLGraphicsConfiguration create(GLProfile glp, AbstractGraphicsScreen absScreen, int cfgID) { + AbstractGraphicsDevice absDevice = absScreen.getDevice(); + if(null==absDevice || !(absDevice instanceof EGLGraphicsDevice)) { + throw new GLException("GraphicsDevice must be a valid EGLGraphicsDevice"); + } + long dpy = absDevice.getHandle(); + if (dpy == EGL.EGL_NO_DISPLAY) { + throw new GLException("Invalid EGL display: "+absDevice); + } + _EGLConfig _cfg = EGLConfigId2EGLConfig(glp, dpy, cfgID); + GLCapabilities caps = EGLConfig2Capabilities(glp, dpy, _cfg); + return new EGLGraphicsConfiguration(absScreen, caps, caps, new DefaultGLCapabilitiesChooser(), _cfg, cfgID); + } + public Object clone() { return super.clone(); } diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index fd6eb458e..cbd485649 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -80,7 +80,7 @@ public abstract class NativeWindowFactory { } private static String _getNativeWindowingType(String osNameLowerCase) { - if (osNameLowerCase.startsWith("kd") || osNameLowerCase.startsWith("linux")) { + if (osNameLowerCase.startsWith("kd")) { return TYPE_EGL; } else if (osNameLowerCase.startsWith("wind")) { return TYPE_WINDOWS; @@ -101,8 +101,6 @@ public abstract class NativeWindowFactory { AccessControlContext acc = AccessController.getContext(); nativeOSNamePure = Debug.getProperty("os.name", false, acc); nativeOSNameCustom = Debug.getProperty("nativewindow.ws.name", true, acc); - System.out.println(nativeOSNamePure); - System.out.println(nativeOSNameCustom); if(null==nativeOSNameCustom||nativeOSNameCustom.length()==0) { nativeOSNameCustom = nativeOSNamePure; } diff --git a/src/newt/classes/com/sun/javafx/newt/Display.java b/src/newt/classes/com/sun/javafx/newt/Display.java index bdac08dab..04fdb0181 100755 --- a/src/newt/classes/com/sun/javafx/newt/Display.java +++ b/src/newt/classes/com/sun/javafx/newt/Display.java @@ -45,16 +45,15 @@ public abstract class Display implements Runnable { { Class displayClass = null; if (NativeWindowFactory.TYPE_EGL.equals(type)) { - // displayClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDDisplay"); - displayClass = Class.forName("com.sun.javafx.newt.opengl.egl.EGLDisplay"); + displayClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDDisplay"); } else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) { displayClass = Class.forName("com.sun.javafx.newt.windows.WindowsDisplay"); } else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) { displayClass = Class.forName("com.sun.javafx.newt.macosx.MacDisplay"); } else if (NativeWindowFactory.TYPE_X11.equals(type)) { displayClass = Class.forName("com.sun.javafx.newt.x11.X11Display"); - } else if (NativeWindowFactory.TYPE_AWT.equals(type)) { - displayClass = Class.forName("com.sun.javafx.newt.awt.AWTDisplay"); + } else if (NewtFactory.TYPE_BROADCOM_EGL.equals(type)) { + displayClass = Class.forName("com.sun.javafx.newt.opengl.broadcom.BCEGLDisplay"); } else { throw new RuntimeException("Unknown display type \"" + type + "\""); } diff --git a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java b/src/newt/classes/com/sun/javafx/newt/NewtFactory.java index b88e1e49e..dbae30a4b 100755 --- a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java +++ b/src/newt/classes/com/sun/javafx/newt/NewtFactory.java @@ -39,6 +39,8 @@ import java.util.Iterator; import com.sun.nativewindow.impl.jvm.JVMUtil; public abstract class NewtFactory { + public static final String TYPE_BROADCOM_EGL = "BroadcomEGL"; + // Work-around for initialization order problems on Mac OS X // between native Newt and (apparently) Fmod static { @@ -50,7 +52,6 @@ public abstract class NewtFactory { * Create a Display entity, incl native creation */ public static Display createDisplay(String name) { - System.out.println("NewtFactory: NAME: " + name); return Display.create(NativeWindowFactory.getNativeWindowType(true), name); } @@ -58,8 +59,6 @@ public abstract class NewtFactory { * Create a Display entity using the given implementation type, incl native creation */ public static Display createDisplay(String type, String name) { - System.out.println("NewtFactory: TYPE: " + type); - System.out.println("NewtFactory: NAME: " + name); return Display.create(type, name); } diff --git a/src/newt/classes/com/sun/javafx/newt/Screen.java b/src/newt/classes/com/sun/javafx/newt/Screen.java index 2566041a8..57ed34211 100755 --- a/src/newt/classes/com/sun/javafx/newt/Screen.java +++ b/src/newt/classes/com/sun/javafx/newt/Screen.java @@ -54,6 +54,8 @@ public abstract class Screen { screenClass = Class.forName("com.sun.javafx.newt.x11.X11Screen"); } else if (NativeWindowFactory.TYPE_AWT.equals(type)) { screenClass = Class.forName("com.sun.javafx.newt.awt.AWTScreen"); + } else if (NewtFactory.TYPE_BROADCOM_EGL.equals(type)) { + screenClass = Class.forName("com.sun.javafx.newt.opengl.broadcom.BCEGLScreen"); } else { throw new RuntimeException("Unknown window type \"" + type + "\""); } diff --git a/src/newt/classes/com/sun/javafx/newt/Window.java b/src/newt/classes/com/sun/javafx/newt/Window.java index 36eafd32d..a1168d12d 100755 --- a/src/newt/classes/com/sun/javafx/newt/Window.java +++ b/src/newt/classes/com/sun/javafx/newt/Window.java @@ -74,6 +74,8 @@ public abstract class Window implements NativeWindow windowClass = Class.forName("com.sun.javafx.newt.x11.X11Window"); } else if (NativeWindowFactory.TYPE_AWT.equals(type)) { windowClass = Class.forName("com.sun.javafx.newt.awt.AWTWindow"); + } else if (NewtFactory.TYPE_BROADCOM_EGL.equals(type)) { + windowClass = Class.forName("com.sun.javafx.newt.opengl.broadcom.BCEGLWindow"); } else { throw new NativeWindowException("Unknown window type \"" + type + "\""); } diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java new file mode 100644 index 000000000..abf9859c5 --- /dev/null +++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + */ + +package com.sun.javafx.newt.opengl.broadcom; + +import com.sun.javafx.newt.*; +import com.sun.javafx.newt.impl.*; +import com.sun.opengl.impl.egl.*; +import javax.media.nativewindow.*; +import javax.media.nativewindow.egl.*; + +public class BCEGLDisplay extends Display { + + static { + NativeLibLoader.loadNEWT(); + + if (!BCEGLWindow.initIDs()) { + throw new NativeWindowException("Failed to initialize BCEGLWindow jmethodIDs"); + } + } + + public static void initSingleton() { + // just exist to ensure static init has been run + } + + + public BCEGLDisplay() { + } + + protected void createNative() { + long handle = CreateDisplay(BCEGLScreen.fixedWidth, BCEGLScreen.fixedHeight); + if (handle == EGL.EGL_NO_DISPLAY) { + throw new NativeWindowException("BC EGL CreateDisplay failed"); + } + aDevice = new EGLGraphicsDevice(handle); + } + + protected void closeNative() { + if (aDevice.getHandle() != EGL.EGL_NO_DISPLAY) { + DestroyDisplay(aDevice.getHandle()); + } + } + + protected void dispatchMessages() { + DispatchMessages(); + } + + private native long CreateDisplay(int width, int height); + private native void DestroyDisplay(long dpy); + private native void DispatchMessages(); +} + diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLScreen.java b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLScreen.java new file mode 100755 index 000000000..165081cde --- /dev/null +++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLScreen.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + */ + +package com.sun.javafx.newt.opengl.broadcom; + +import com.sun.javafx.newt.*; +import com.sun.javafx.newt.impl.*; +import javax.media.nativewindow.*; + +public class BCEGLScreen extends Screen { + + static { + BCEGLDisplay.initSingleton(); + } + + + public BCEGLScreen() { + } + + protected void createNative(int index) { + aScreen = new DefaultGraphicsScreen(getDisplay().getGraphicsDevice(), index); + setScreenSize(fixedWidth, fixedHeight); + } + + protected void closeNative() { } + + //---------------------------------------------------------------------- + // Internals only + // + + static final int fixedWidth = 1920; + static final int fixedHeight = 1080; +} + 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 new file mode 100755 index 000000000..a91a91598 --- /dev/null +++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + */ + +package com.sun.javafx.newt.opengl.broadcom; + +import com.sun.javafx.newt.*; +import com.sun.javafx.newt.impl.*; +import com.sun.opengl.impl.egl.*; +import javax.media.nativewindow.*; +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLProfile; +import javax.media.nativewindow.NativeWindowException; + +public class BCEGLWindow extends Window { + static { + BCEGLDisplay.initSingleton(); + } + + public BCEGLWindow() { + } + + protected void createNative(Capabilities caps) { + // just save the GLProfile here, create window later .. + glProfile = ((GLCapabilities)caps).getGLProfile(); + } + + protected void closeNative() { + if(0!=windowHandleClose) { + CloseWindow(getDisplayHandle(), windowHandleClose); + } + } + + public void setVisible(boolean visible) { + if(this.visible!=visible) { + this.visible=visible; + if ( 0==windowHandle ) { + windowHandle = realizeWindow(true, width, height); + if (0 == windowHandle) { + throw new NativeWindowException("Error native Window Handle is null"); + } + } + clearEventMask(); + } + } + + public void setSize(int width, int height) { + if(0!=windowHandle) { + // n/a in BroadcomEGL + System.err.println("setSize n/a in BroadcomEGL with realized window"); + } else { + this.width = width; + this.height = height; + } + } + + public void setPosition(int x, int y) { + // n/a in BroadcomEGL + System.err.println("setPosition n/a in BroadcomEGL"); + } + + public boolean setFullscreen(boolean fullscreen) { + // n/a in BroadcomEGL + System.err.println("setFullscreen n/a in BroadcomEGL"); + return false; + } + + //---------------------------------------------------------------------- + // Internals only + // + + 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 long realizeWindow(boolean chromaKey, int width, int height) { + long handle = CreateWindow(getDisplayHandle(), chromaKey, width, height); + if (0 == handle) { + throw new NativeWindowException("Error native Window Handle is null"); + } + windowHandleClose = handle; + return handle; + } + + private void windowCreated(int cfgID, int width, int height) { + this.width = width; + this.height = height; + config = EGLGraphicsConfiguration.create(glProfile, screen.getGraphicsScreen(), cfgID); + if (config == null) { + throw new NativeWindowException("Error creating EGLGraphicsConfiguration from id: "+cfgID+", "+this); + } + } + + private long windowHandleClose; + private GLProfile glProfile; +} diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/egl/EGLDisplay.java b/src/newt/classes/com/sun/javafx/newt/opengl/egl/EGLDisplay.java deleted file mode 100644 index bebb7ccf2..000000000 --- a/src/newt/classes/com/sun/javafx/newt/opengl/egl/EGLDisplay.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - */ - -package com.sun.javafx.newt.opengl.egl; - -import com.sun.javafx.newt.*; -import com.sun.javafx.newt.impl.*; -import com.sun.opengl.impl.egl.*; -import javax.media.nativewindow.*; -import javax.media.nativewindow.egl.*; - -public class EGLDisplay extends Display { - - static { - NativeLibLoader.loadNEWT(); - - System.loadLibrary("EglUtil"); - } - - public static void initSingleton() { - // just exist to ensure static init has been run - } - - - public EGLDisplay() { - } - - protected void createNative() { - try { - int windowWidth = 1920, windowHeight = 1080; - int width[] = { windowWidth }; - int height[] = { windowHeight }; - long eglDisplayHandle = - EGL.EGLUtil_CreateDisplayByNative(windowWidth, windowHeight); - long eglSurfaceHandle = - EGL.EGLUtil_CreateWindowByNative(eglDisplayHandle, 1, - width, 0, height, 0); - } catch (Throwable th) { - th.printStackTrace(); - } - } - - protected void closeNative() { - if (aDevice.getHandle() != EGL.EGL_NO_DISPLAY) { - EGL.eglTerminate(aDevice.getHandle()); - } - } - - protected void dispatchMessages() { - DispatchMessages(); - } - - private native void DispatchMessages(); -} - diff --git a/src/newt/native/BroadcomEGL.c b/src/newt/native/BroadcomEGL.c new file mode 100755 index 000000000..8afa71a47 --- /dev/null +++ b/src/newt/native/BroadcomEGL.c @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + */ + +#ifdef _WIN32 + #include +#else + #include +#endif + +#include +#include +#include + +#include "com_sun_javafx_newt_opengl_broadcom_BCEGLWindow.h" + +#include "EventListener.h" +#include "MouseEvent.h" +#include "KeyEvent.h" + +#include + +typedef unsigned int GLuint; + +EGLDisplay EGLUtil_CreateDisplay( GLuint uiWidth, GLuint uiHeight ); +void EGLUtil_DestroyDisplay( EGLDisplay eglDisplay ); + +EGLSurface EGLUtil_CreateWindow( EGLDisplay eglDisplay, /* bool */ GLuint bChromakey, GLuint *puiWidth, GLuint *puiHeight ); +void EGLUtil_DestroyWindow( EGLDisplay eglDisplay, EGLSurface eglSurface ); +void EGLUtil_SwapWindow( EGLDisplay eglDisplay, EGLSurface eglSurface ); + +#define VERBOSE_ON 1 + +#ifdef VERBOSE_ON + #define DBG_PRINT(...) fprintf(stdout, __VA_ARGS__) +#else + #define DBG_PRINT(...) +#endif + +static jmethodID windowCreatedID = NULL; + +/** + * Display + */ + +JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLDisplay_DispatchMessages + (JNIEnv *env, jobject obj) +{ + // FIXME: n/a + (void) env; + (void) obj; +} + +JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLDisplay_CreateDisplay + (JNIEnv *env, jobject obj, jint width, jint height) +{ + (void) env; + (void) obj; + EGLDisplay dpy = EGLUtil_CreateDisplay( (GLuint) width, (GLuint) height ); + if(NULL==dpy) { + fprintf(stderr, "[CreateDisplay] failed: NULL\n"); + } else { + DBG_PRINT( "[CreateDisplay] ok: %p, %ux%u\n", dpy, width, height); + } + return (jlong) (intptr_t) dpy; +} + +JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLDisplay_DestroyDisplay + (JNIEnv *env, jobject obj, jlong display) +{ + EGLDisplay dpy = (EGLDisplay)(intptr_t)display; + (void) env; + (void) obj; + EGLUtil_DestroyDisplay(dpy); +} + +/** + * Window + */ + +JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_initIDs + (JNIEnv *env, jclass clazz) +{ + windowCreatedID = (*env)->GetMethodID(env, clazz, "windowCreated", "(III)V"); + if (windowCreatedID == NULL) { + DBG_PRINT( "initIDs failed\n" ); + return JNI_FALSE; + } + DBG_PRINT( "initIDs ok\n" ); + return JNI_TRUE; +} + +JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_CreateWindow + (JNIEnv *env, jobject obj, jlong display, jboolean chromaKey, jint width, jint height) +{ + EGLDisplay dpy = (EGLDisplay)(intptr_t)display; + EGLSurface window = 0; + GLuint uiWidth=(GLuint)width, uiHeight=(GLuint)height; + + if(dpy==NULL) { + fprintf(stderr, "[RealizeWindow] invalid display connection..\n"); + return 0; + } + + window = EGLUtil_CreateWindow( dpy, chromaKey, &uiWidth, &uiHeight ); + // EGLUtil_DestroyWindow( dpy, window ); + + if(NULL==window) { + fprintf(stderr, "[RealizeWindow.Create] failed: NULL\n"); + return 0; + } + EGLint cfgID=0; + if(EGL_FALSE==eglQuerySurface(dpy, window, EGL_CONFIG_ID, &cfgID)) { + fprintf(stderr, "[RealizeWindow.ConfigID] failed: window %p\n", window); + EGLUtil_DestroyWindow(dpy, window); + return 0; + } + (*env)->CallVoidMethod(env, obj, windowCreatedID, (jint) cfgID, (jint)uiWidth, (jint)uiHeight); + DBG_PRINT( "[RealizeWindow.Create] ok: %p, cfgid %d, %ux%u\n", window, cfgID, uiWidth, uiHeight); + + // release and destroy already made context .. + EGLContext ctx = eglGetCurrentContext(); + eglMakeCurrent(dpy, + EGL_NO_SURFACE, + EGL_NO_SURFACE, + EGL_NO_CONTEXT); + eglDestroyContext(dpy, ctx); + + return (jlong) (intptr_t) window; +} + +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; + EGLSurface surf = (EGLSurface) (intptr_t) window; + EGLUtil_DestroyWindow(dpy, surf); + + DBG_PRINT( "[CloseWindow]\n"); +} + diff --git a/src/newt/native/KDWindow.c b/src/newt/native/KDWindow.c index 8e57237b3..6c7aa7731 100755 --- a/src/newt/native/KDWindow.c +++ b/src/newt/native/KDWindow.c @@ -103,7 +103,7 @@ static jmethodID sendKeyEventID = NULL; * Display */ -JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDDisplay_DispatchMessages +JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDDisplay_DispatchMessages (JNIEnv *env, jobject obj) { const KDEvent * evt; @@ -200,7 +200,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDDisplay_DispatchMessages * Window */ -JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_kd_KDWindow_initIDs +JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_initIDs (JNIEnv *env, jclass clazz) { #ifdef VERBOSE_ON @@ -228,7 +228,7 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_kd_KDWindow_initIDs return JNI_TRUE; } -JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_kd_KDWindow_CreateWindow +JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_CreateWindow (JNIEnv *env, jobject obj, jlong display, jintArray jAttrs) { jint * attrs = NULL; @@ -270,7 +270,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_kd_KDWindow_CreateWindow return (jlong) (intptr_t) window; } -JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_kd_KDWindow_RealizeWindow +JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_RealizeWindow (JNIEnv *env, jobject obj, jlong window) { KDWindow *w = (KDWindow*) (intptr_t) window; @@ -285,7 +285,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_kd_KDWindow_RealizeWindow return (jlong) (intptr_t) nativeWindow; } -JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_kd_KDWindow_CloseWindow +JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_CloseWindow (JNIEnv *env, jobject obj, jlong window, jlong juserData) { KDWindow *w = (KDWindow*) (intptr_t) window; @@ -299,11 +299,11 @@ JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_kd_KDWindow_CloseWindow } /* - * Class: com_sun_javafx_newt_kd_KDWindow + * Class: com_sun_javafx_newt_opengl_kd_KDWindow * Method: setVisible0 * Signature: (JJZ)V */ -JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_setVisible0 +JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setVisible0 (JNIEnv *env, jobject obj, jlong window, jboolean visible) { KDWindow *w = (KDWindow*) (intptr_t) window; @@ -312,7 +312,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_setVisible0 DBG_PRINT( "[setVisible] v=%d\n", visible); } -JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_setFullScreen0 +JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setFullScreen0 (JNIEnv *env, jobject obj, jlong window, jboolean fullscreen) { KDWindow *w = (KDWindow*) (intptr_t) window; @@ -323,7 +323,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_setFullScreen0 (void)res; } -JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_setSize0 +JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setSize0 (JNIEnv *env, jobject obj, jlong window, jint width, jint height) { KDWindow *w = (KDWindow*) (intptr_t) window; -- cgit v1.2.3 From 0a92a47567cfa36b33590bacf4c782c0ec4f9eaf Mon Sep 17 00:00:00 2001 From: sg215889 Date: Tue, 28 Jul 2009 15:49:12 -0700 Subject: Fix BroadcomEGL: Proper EGLGraphicsConfiguration at creation time --- .../com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java | 5 +++-- .../com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src/newt/classes/com/sun/javafx') diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java index 08fbae5bc..574c3c8cf 100644 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java @@ -62,7 +62,7 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple configID = cfgID; } - public static EGLGraphicsConfiguration create(GLProfile glp, AbstractGraphicsScreen absScreen, int cfgID) { + public static EGLGraphicsConfiguration create(GLCapabilities capsRequested, AbstractGraphicsScreen absScreen, int cfgID) { AbstractGraphicsDevice absDevice = absScreen.getDevice(); if(null==absDevice || !(absDevice instanceof EGLGraphicsDevice)) { throw new GLException("GraphicsDevice must be a valid EGLGraphicsDevice"); @@ -71,9 +71,10 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple if (dpy == EGL.EGL_NO_DISPLAY) { throw new GLException("Invalid EGL display: "+absDevice); } + GLProfile glp = capsRequested.getGLProfile(); _EGLConfig _cfg = EGLConfigId2EGLConfig(glp, dpy, cfgID); GLCapabilities caps = EGLConfig2Capabilities(glp, dpy, _cfg); - return new EGLGraphicsConfiguration(absScreen, caps, caps, new DefaultGLCapabilitiesChooser(), _cfg, cfgID); + return new EGLGraphicsConfiguration(absScreen, caps, capsRequested, new DefaultGLCapabilitiesChooser(), _cfg, cfgID); } public Object clone() { 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 a91a91598..9b790bd1f 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 @@ -50,8 +50,12 @@ public class BCEGLWindow extends Window { } protected void createNative(Capabilities caps) { - // just save the GLProfile here, create window later .. - glProfile = ((GLCapabilities)caps).getGLProfile(); + // query a good configuration .. even thought we drop this one + // and reuse the EGLUtil choosen one later. + config = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice()).chooseGraphicsConfiguration(caps, null, getScreen().getGraphicsScreen()); + if (config == null) { + throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); + } } protected void closeNative() { @@ -115,12 +119,12 @@ public class BCEGLWindow extends Window { private void windowCreated(int cfgID, int width, int height) { this.width = width; this.height = height; - config = EGLGraphicsConfiguration.create(glProfile, screen.getGraphicsScreen(), cfgID); + GLCapabilities capsReq = (GLCapabilities) config.getRequestedCapabilities(); + config = EGLGraphicsConfiguration.create(capsReq, screen.getGraphicsScreen(), cfgID); if (config == null) { throw new NativeWindowException("Error creating EGLGraphicsConfiguration from id: "+cfgID+", "+this); } } private long windowHandleClose; - private GLProfile glProfile; } -- cgit v1.2.3 From 4b5e1a0f826597d8cdcf81865194ee8d67511b70 Mon Sep 17 00:00:00 2001 From: sg215889 Date: Tue, 28 Jul 2009 19:03:32 -0700 Subject: Cleanup .. --- make/build-jogl.xml | 24 ++++------------- make/build-nativewindow.xml | 31 +++++++--------------- make/build-newt.xml | 28 ++++++------------- make/make.jogl.all.linux-x86.sh | 2 +- .../com/sun/opengl/impl/GLDrawableImpl.java | 19 +------------ .../sun/opengl/impl/egl/EGLDrawableFactory.java | 6 +---- .../opengl/impl/egl/EGLDynamicLookupHelper.java | 14 +++------- src/jogl/classes/javax/media/opengl/GLProfile.java | 6 ++--- .../com/sun/nativewindow/impl/NWReflection.java | 11 ++------ .../javafx/newt/opengl/broadcom/BCEGLWindow.java | 3 +++ src/newt/native/BroadcomEGL.c | 2 +- 11 files changed, 38 insertions(+), 108 deletions(-) (limited to 'src/newt/classes/com/sun/javafx') diff --git a/make/build-jogl.xml b/make/build-jogl.xml index fda65c5b2..6a065a8e4 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -51,8 +51,8 @@ - - Some environment defs affecting compilation - - setup.noAWT is set iff: - !isWindows && !isOSX && !noX11 + - setup.nodesktop is set iff: + !isWindows && !isOSX && !isX11 - Internal settings, may not be necessary to set them manually, since all JAR archives are orthogonal. @@ -77,7 +77,7 @@ --> - + @@ -86,25 +86,11 @@ - - - - - - - - - - - - - - + - @@ -1769,7 +1755,7 @@ includes="${java.part.util.fixedfunc.shaders}"/> - + - + @@ -77,21 +77,13 @@ - - - - - - - - - + + - @@ -108,17 +100,12 @@ - - - - - + @@ -842,13 +829,13 @@ - + - + @@ -865,7 +852,7 @@ - + diff --git a/make/build-newt.xml b/make/build-newt.xml index 1ed039a57..be9547684 100644 --- a/make/build-newt.xml +++ b/make/build-newt.xml @@ -50,8 +50,8 @@ setup.noAWT setup.noOpenGL - - setup.noAWT is set iff: - !isWindows && !isOSX && !noX11 + - setup.nodesktop is set iff: + !isWindows && !isOSX && !isX11 --> @@ -73,28 +73,16 @@ - + + - - - - - - - - - - - - - - + @@ -110,7 +98,6 @@ - @@ -764,10 +751,11 @@ - + + includes="com/sun/javafx/newt/**" + excludes="${java.excludes.cdcfp}" /> diff --git a/make/make.jogl.all.linux-x86.sh b/make/make.jogl.all.linux-x86.sh index 8842cbc0c..0f764b360 100644 --- a/make/make.jogl.all.linux-x86.sh +++ b/make/make.jogl.all.linux-x86.sh @@ -13,13 +13,13 @@ fi # -DisUnix=true \ # -DisLinux=true \ # -DisLinuxX86=true \ +# -DisX11=true \ ant \ -Dbuild.noarchives=true \ -Djogl.cg=1 -Dx11.cg.lib=../../lib-linux-x86 \ -Drootrel.build=build-x86 \ -Dos.arch=x86 \ - -DisX11=true \ -DuseKD=true \ -DuseOpenMAX=true \ $* 2>&1 | tee make.jogl.all.linux-x86.log diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java index e71cf33a0..c381f68f5 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java @@ -52,24 +52,7 @@ public abstract class GLDrawableImpl implements GLDrawable { this.factory = factory; this.component = comp; this.realized = realized; - - AbstractGraphicsConfiguration agc = component.getGraphicsConfiguration(); - if (agc == null) { - System.out.println("GLDrawableImpl no AbstractGraphicsConfiguration"); - System.out.println(component.getClass().getName()); - return; - } - AbstractGraphicsConfiguration ngc = agc.getNativeGraphicsConfiguration(); - if (ngc == null) { - System.out.println("GLDrawableImpl no native AbstractGraphicsConfiguration"); - return; - } - Capabilities caps = ngc.getRequestedCapabilities(); - if (caps == null) { - System.out.println("GLDrawableImpl no native Capabilities"); - return; - } - this.requestedCapabilities = (GLCapabilities)caps; // a copy .. + this.requestedCapabilities = (GLCapabilities)component.getGraphicsConfiguration().getNativeGraphicsConfiguration().getRequestedCapabilities(); // a copy .. } /** diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java index e2ee65d27..396580c1d 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java @@ -45,19 +45,15 @@ import com.sun.gluegen.runtime.NativeLibrary; public class EGLDrawableFactory extends GLDrawableFactoryImpl { static { - try { // Register our GraphicsConfigurationFactory implementations // The act of constructing them causes them to be registered new EGLGraphicsConfigurationFactory(); // Check for other underlying stuff .. - /* if(NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(false))) { + if(NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(false))) { try { NWReflection.createInstance("com.sun.opengl.impl.x11.glx.X11GLXGraphicsConfigurationFactory"); } catch (Throwable t) {} - } */ - } catch (Throwable th) { - th.printStackTrace(); } } diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java index 99f163ca1..8bed0eb35 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java @@ -50,7 +50,7 @@ import com.sun.gluegen.runtime.DynamicLookupHelper; * Currently two implementations exist, one for ES1 and one for ES2. */ public abstract class EGLDynamicLookupHelper implements DynamicLookupHelper { - protected static final boolean DEBUG = true; /* com.sun.opengl.impl.Debug.debug("EGL"); */ + protected static final boolean DEBUG = com.sun.opengl.impl.Debug.debug("EGL"); private static final EGLDynamicLookupHelper eglES1DynamicLookupHelper; private static final EGLDynamicLookupHelper eglES2DynamicLookupHelper; @@ -136,13 +136,9 @@ public abstract class EGLDynamicLookupHelper implements DynamicLookupHelper { private NativeLibrary loadFirstAvailable(List/**/ libNames, ClassLoader loader) { for (Iterator iter = libNames.iterator(); iter.hasNext(); ) { - String libname = (String) iter.next(); - NativeLibrary lib = NativeLibrary.open(libname, loader, false /*global*/); + NativeLibrary lib = NativeLibrary.open((String) iter.next(), loader, false /*global*/); if (lib != null) { - System.out.println("found: " + libname); return lib; - } else { - System.out.println("looked for: " + libname); } } return null; @@ -168,11 +164,9 @@ public abstract class EGLDynamicLookupHelper implements DynamicLookupHelper { // EGL libraries .. lib = loadFirstAvailable(eglLibNames, loader); if (lib == null) { - // throw new GLException("Unable to dynamically load EGL library for profile ES" + esProfile); - System.out.println("Unable to dynamically load EGL library for profile ES" + esProfile); - } else { - glesLibraries.add(lib); + throw new GLException("Unable to dynamically load EGL library for profile ES" + esProfile); } + glesLibraries.add(lib); } if (esProfile==2) { diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 83a9b0098..ead5f6396 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -54,7 +54,7 @@ import com.sun.nativewindow.impl.jvm.JVMUtil; * or more specialized versions using the other static GetProfile methods. */ public class GLProfile implements Cloneable { - public static final boolean DEBUG = true; /* Debug.debug("GLProfile"); */ + public static final boolean DEBUG = Debug.debug("GLProfile"); // // Public (user-visible) profiles @@ -736,8 +736,8 @@ public class GLProfile implements Cloneable { } } mappedProfiles = _mappedProfiles; // final .. - if (null==defaultGLProfile) { - System.out.println("No profile available: "+list2String(GL_PROFILE_LIST_ALL)); + if(null==defaultGLProfile) { + throw new GLException("No profile available: "+list2String(GL_PROFILE_LIST_ALL)); } } diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/NWReflection.java b/src/nativewindow/classes/com/sun/nativewindow/impl/NWReflection.java index d054c205b..b13cf4317 100644 --- a/src/nativewindow/classes/com/sun/nativewindow/impl/NWReflection.java +++ b/src/nativewindow/classes/com/sun/nativewindow/impl/NWReflection.java @@ -40,7 +40,7 @@ import java.lang.reflect.*; import javax.media.nativewindow.*; public final class NWReflection { - public static final boolean DEBUG = true; /* Debug.debug("NWReflection"); */ + public static final boolean DEBUG = Debug.debug("NWReflection"); public static final boolean isClassAvailable(String clazzName) { try { @@ -69,11 +69,7 @@ public final class NWReflection { try { factory = factoryClass.getDeclaredConstructor( cstrArgTypes ); } catch(NoSuchMethodException nsme) { - nsme.printStackTrace(); - throw new NativeWindowException("Constructor: '" + clazzName + "("+cstrArgTypes+")' not found"); - } catch (Throwable th) { - th.printStackTrace(); - throw new NativeWindowException(th); + throw new NativeWindowException("Constructor: '" + clazzName + "("+cstrArgTypes+")' not found"); } return factory; } catch (Throwable e) { @@ -95,9 +91,6 @@ public final class NWReflection { factory = getConstructor(clazzName, cstrArgTypes); return factory.newInstance( cstrArgs ) ; } catch (Exception e) { - if (DEBUG) { - e.printStackTrace(); - } throw new NativeWindowException(e); } } 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 9b790bd1f..29b92bc8f 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 @@ -124,6 +124,9 @@ public class BCEGLWindow extends Window { if (config == null) { throw new NativeWindowException("Error creating EGLGraphicsConfiguration from id: "+cfgID+", "+this); } + if(DEBUG_IMPLEMENTATION) { + System.out.println("BCEGLWindow.windowCreated: 0x"+Integer.toHexString(cfgID)+", "+width+"x"+height+", "+config); + } } private long windowHandleClose; diff --git a/src/newt/native/BroadcomEGL.c b/src/newt/native/BroadcomEGL.c index 55ca5f155..716f7d9ee 100755 --- a/src/newt/native/BroadcomEGL.c +++ b/src/newt/native/BroadcomEGL.c @@ -58,7 +58,7 @@ EGLSurface EGLUtil_CreateWindow( EGLDisplay eglDisplay, /* bool */ GLuint bChrom void EGLUtil_DestroyWindow( EGLDisplay eglDisplay, EGLSurface eglSurface ); void EGLUtil_SwapWindow( EGLDisplay eglDisplay, EGLSurface eglSurface ); -#define VERBOSE_ON 1 +// #define VERBOSE_ON 1 #ifdef VERBOSE_ON #define DBG_PRINT(...) fprintf(stdout, __VA_ARGS__) -- cgit v1.2.3 From 219abab46a80b4529c09e9b1e1b77906d6a93dca Mon Sep 17 00:00:00 2001 From: sg215889 Date: Tue, 28 Jul 2009 21:32:28 -0700 Subject: NEWT: Remove loading of non-existing nativewindow lib; BroadcomEGL: use libEGL(EglUtil) and libGLES_CM(nexus), setSize to screen-size on creation, more debug output --- make/build-newt.xml | 4 ++-- .../com/sun/opengl/impl/egl/EGLES1DynamicLookupHelper.java | 2 -- src/newt/classes/com/sun/javafx/newt/impl/NativeLibLoader.java | 3 +-- .../com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java | 10 +++++++++- 4 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src/newt/classes/com/sun/javafx') diff --git a/make/build-newt.xml b/make/build-newt.xml index be9547684..acf78f09a 100644 --- a/make/build-newt.xml +++ b/make/build-newt.xml @@ -357,8 +357,8 @@ - - + + diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLES1DynamicLookupHelper.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLES1DynamicLookupHelper.java index 68630344a..7e60e25c0 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLES1DynamicLookupHelper.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLES1DynamicLookupHelper.java @@ -58,8 +58,6 @@ public class EGLES1DynamicLookupHelper extends EGLDynamicLookupHelper { protected List/**/ getGLESLibNames() { List/**/ glesLibNames = new ArrayList(); - glesLibNames.add("nexus"); - glesLibNames.add("GLES_CM"); glesLibNames.add("GLES_CL"); glesLibNames.add("GLESv1_CM"); diff --git a/src/newt/classes/com/sun/javafx/newt/impl/NativeLibLoader.java b/src/newt/classes/com/sun/javafx/newt/impl/NativeLibLoader.java index 6316e750f..d96c56f6e 100644 --- a/src/newt/classes/com/sun/javafx/newt/impl/NativeLibLoader.java +++ b/src/newt/classes/com/sun/javafx/newt/impl/NativeLibLoader.java @@ -53,8 +53,7 @@ public class NativeLibLoader extends NativeLibLoaderBase { public static void loadNEWT() { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - String[] preload = { "nativewindow" }; - loadLibrary("newt", preload, true); + loadLibrary("newt", null, true); return null; } }); 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 29b92bc8f..c8436b928 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 @@ -56,6 +56,7 @@ public class BCEGLWindow extends Window { if (config == null) { throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); } + setSize(getScreen().getWidth(), getScreen().getHeight()); } protected void closeNative() { @@ -82,6 +83,10 @@ public class BCEGLWindow extends Window { // n/a in BroadcomEGL System.err.println("setSize 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); + e.printStackTrace(); + } this.width = width; this.height = height; } @@ -108,6 +113,9 @@ public class BCEGLWindow extends Window { private long realizeWindow(boolean chromaKey, int width, int height) { + if(DEBUG_IMPLEMENTATION) { + System.out.println("BCEGLWindow.realizeWindow() with: chroma "+chromaKey+", "+width+"x"+height+", "+config); + } long handle = CreateWindow(getDisplayHandle(), chromaKey, width, height); if (0 == handle) { throw new NativeWindowException("Error native Window Handle is null"); @@ -125,7 +133,7 @@ public class BCEGLWindow extends Window { throw new NativeWindowException("Error creating EGLGraphicsConfiguration from id: "+cfgID+", "+this); } if(DEBUG_IMPLEMENTATION) { - System.out.println("BCEGLWindow.windowCreated: 0x"+Integer.toHexString(cfgID)+", "+width+"x"+height+", "+config); + System.out.println("BCEGLWindow.windowCreated(): 0x"+Integer.toHexString(cfgID)+", "+width+"x"+height+", "+config); } } -- cgit v1.2.3 From b5ce9cce6223810c6df7b66cf1a51318309fdc90 Mon Sep 17 00:00:00 2001 From: sg215889 Date: Wed, 29 Jul 2009 06:27:46 -0700 Subject: Fixed GL* documentation. Moved common GL functions to GLBase. Moved glAllocateMemoryNV to GL2GL3 only. Add GL2GL3 interface. Fix some GL2 signatures. BroadcomEGL disable custom setSize(). --- make/build-jogl.xml | 38 +++- make/config/jogl/eglext.cfg | 2 +- make/config/jogl/gl-common.cfg | 204 ++++++++------------- make/config/jogl/gl-es1.cfg | 12 +- make/config/jogl/gl-es2.cfg | 6 +- make/config/jogl/gl-gl2-set.cfg | 13 ++ make/config/jogl/gl-gl2.cfg | 17 +- make/config/jogl/gl-gl3.cfg | 9 +- make/config/jogl/gl-if-gl.cfg | 2 +- make/config/jogl/gl-if-gl2_es1.cfg | 10 +- make/config/jogl/gl-if-gl2_es2.cfg | 4 +- make/config/jogl/gl-if-gl2_gl3.cfg | 39 ++++ make/config/jogl/gl-impl-CustomJavaCode-gl2.java | 8 + .../jogl/gl-impl-CustomJavaCode-gl2es12.java | 16 +- make/config/jogl/gl-impl-CustomJavaCode-gl3.java | 8 + make/config/jogl/gl-impl-CustomJavaCode-gles1.java | 16 +- make/config/jogl/gl-impl-CustomJavaCode-gles2.java | 16 +- make/config/jogl/glxext.cfg | 2 +- make/doc/jogl/spec-overview.html | 13 +- make/lsGL2toGL3_commons.sh | 4 +- make/lsGL2toGL3_unique.sh | 16 ++ make/stub_includes/opengl/GL/glext.h | 8 +- src/jogl/classes/javax/media/opengl/GLBase.java | 148 ++++++++++++++- src/jogl/classes/javax/media/opengl/GLProfile.java | 14 +- .../classes/javax/media/opengl/awt/GLJPanel.java | 30 +-- .../javafx/newt/opengl/broadcom/BCEGLWindow.java | 6 +- 26 files changed, 435 insertions(+), 226 deletions(-) create mode 100644 make/config/jogl/gl-gl2-set.cfg create mode 100644 make/config/jogl/gl-if-gl2_gl3.cfg create mode 100644 make/lsGL2toGL3_unique.sh (limited to 'src/newt/classes/com/sun/javafx') diff --git a/make/build-jogl.xml b/make/build-jogl.xml index 6a065a8e4..0f9a230a2 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -143,7 +143,7 @@ value="com/sun/opengl/impl/**/gl2/**"/> + value="javax/media/opengl/TraceGL2.* javax/media/opengl/DebugGL2.* javax/media/opengl/TraceGL2GL3.* javax/media/opengl/DebugGL2GL3.*"/> @@ -637,6 +637,25 @@ + + + + + + + + + + + @@ -697,7 +716,7 @@ - + @@ -1797,17 +1821,17 @@ + excludes="${java.part.gl2.dbg}, ${java.part.gl3.dbg}, ${java.part.glugl2}"/> + excludes="${java.part.gl2.dbg}, ${java.part.gl3.dbg}, ${java.part.glugl2}"/> + excludes="${java.part.gl2.dbg}, ${java.part.gl3.dbg}, ${java.part.glugl2}"/> The basic interface to OpenGL, providing access to core -ClassJavadoc GL * functionality up through the OpenGL 2.0 specification as well as -ClassJavadoc GL * all vendor extensions.

-ClassJavadoc GL * -ClassJavadoc GL *

While the APIs for vendor extensions are unconditionally -ClassJavadoc GL * exposed, the underlying functions may not be present. The method -ClassJavadoc GL * {@link #isFunctionAvailable} should be used to query the -ClassJavadoc GL * availability of any non-core function before it is used for the -ClassJavadoc GL * first time; for example, -ClassJavadoc GL * gl.isFunctionAvailable("glProgramStringARB"). On -ClassJavadoc GL * certain platforms (Windows in particular), the most "core" -ClassJavadoc GL * functionality is only OpenGL 1.1, so in theory any routines first -ClassJavadoc GL * exposed in OpenGL 1.2, 1.3, and 1.4, 1.5, or 2.0 as well as vendor -ClassJavadoc GL * extensions should all be queried. Calling an unavailable function -ClassJavadoc GL * will cause a {@link GLException} to be raised.

-ClassJavadoc GL * -ClassJavadoc GL * {@link #isExtensionAvailable} may also be used to determine whether -ClassJavadoc GL * a specific extension is available before calling the routines or -ClassJavadoc GL * using the functionality it exposes: for example, -ClassJavadoc GL * gl.isExtensionAvailable("GL_ARB_vertex_program");. -ClassJavadoc GL * However, in this case it is up to the end user to know which -ClassJavadoc GL * routines or functionality are associated with which OpenGL -ClassJavadoc GL * extensions. It may also be used to test for the availability of a -ClassJavadoc GL * particular version of OpenGL: for example, -ClassJavadoc GL * gl.isExtensionAvailable("GL_VERSION_1_5");. -ClassJavadoc GL * -ClassJavadoc GL *

Exceptions to the window system extension naming rules: -ClassJavadoc GL * -ClassJavadoc GL *

    -ClassJavadoc GL * -ClassJavadoc GL *
  • The memory allocators for the NVidia vertex_array_range (VAR) -ClassJavadoc GL * extension, in particular wglAllocateMemoryNV / -ClassJavadoc GL * glXAllocateMemoryNV and associated routines. {@link -ClassJavadoc GL * #glAllocateMemoryNV} has been provided for window system-independent -ClassJavadoc GL * access to VAR. {@link #isFunctionAvailable} will translate an argument -ClassJavadoc GL * of "glAllocateMemoryNV" or "glFreeMemoryNV" into the appropriate -ClassJavadoc GL * window system-specific name.

    -ClassJavadoc GL * -ClassJavadoc GL *
  • WGL_ARB_pbuffer, WGL_ARB_pixel_format, and other -ClassJavadoc GL * platform-specific pbuffer functionality; the availability of -ClassJavadoc GL * pbuffers can be queried on Windows, X11 and Mac OS X platforms by -ClassJavadoc GL * querying {@link #isExtensionAvailable} with an argument of -ClassJavadoc GL * "GL_ARB_pbuffer" or "GL_ARB_pixel_format". -ClassJavadoc GL * -ClassJavadoc GL *

-ClassJavadoc GL * +ClassJavadoc GL *

Common interface containing the subset of all profiles, GL3, GL2, GLES1 and GLES2.
+ClassJavadoc GL * This interface reflects common data types, texture and framebuffer functionality.

ClassJavadoc GL */ +ClassJavadoc GL2ES1 /** +ClassJavadoc GL2ES1 *

+ClassJavadoc GL2ES1 * Interface containing the common subset of GL2 and GLES1.
+ClassJavadoc GL2ES1 * This interface reflects only the fixed functionality of OpenGL
+ClassJavadoc GL2ES1 *

+ClassJavadoc GL2ES1 */ + +ClassJavadoc GL2ES2 /** +ClassJavadoc GL2ES2 *

+ClassJavadoc GL2ES2 * Interface containing the common subset of GL3, GL2 and GLES2.
+ClassJavadoc GL2ES2 * This interface reflects only the programmable shader functionality of desktop and embedded OpenGL
+ClassJavadoc GL2ES2 *

+ClassJavadoc GL2ES2 */ + +ClassJavadoc GL2GL3 /** +ClassJavadoc GL2GL3 *

+ClassJavadoc GL2GL3 * Interface containing the common subset of GL3 and GL2.
+ClassJavadoc GL2GL3 * This interface reflects only the programmable shader functionality of desktop OpenGL
+ClassJavadoc GL2GL3 *

+ClassJavadoc GL2GL3 */ + +ClassJavadoc GL2 /** +ClassJavadoc GL2 *

+ClassJavadoc GL2 * This interface contains all core desktop OpenGL methods through +ClassJavadoc GL2 * version 3.0, inclusive, as well as most of it's extensions defined at the +ClassJavadoc GL2 * time of this specification. Early OpenGL extensions whose functionality +ClassJavadoc GL2 * was incorporated into core OpenGL by version 2.0, inclusive, are specifically +ClassJavadoc GL2 * excluded. +ClassJavadoc GL2 *

+ClassJavadoc GL2 */ + +ClassJavadoc GL3 /** +ClassJavadoc GL3 *

+ClassJavadoc GL3 * This interface contains all core desktop OpenGL methods starting from 3.1, +ClassJavadoc GL3 * inclusive - forward compatible only, as well as most of it's extensions defined at the +ClassJavadoc GL3 * time of this specification.
+ClassJavadoc GL3 *

+ClassJavadoc GL3 */ + +ClassJavadoc GLES1 /** +ClassJavadoc GLES1 *

+ClassJavadoc GLES1 * This interface contains all core embedded OpenGL methods of ES 1.x, with x >= 0, +ClassJavadoc GLES1 * inclusive, as well as most of it's extensions defined at the +ClassJavadoc GLES1 * time of this specification. +ClassJavadoc GLES1 *

+ClassJavadoc GLES1 */ + +ClassJavadoc GLES2 /** +ClassJavadoc GLES2 *

+ClassJavadoc GLES2 * This interface contains all core embedded OpenGL methods of ES 2.x, with x >= 0, +ClassJavadoc GLES2 * inclusive, as well as most of it's extensions defined at the +ClassJavadoc GLES2 * time of this specification. +ClassJavadoc GLES2 *

+ClassJavadoc GLES2 */ + +# Javadoc for the EGL class +ClassJavadoc EGL /** +ClassJavadoc EGL * Provides access to the embedded-specific OpenGL vendor extensions. +ClassJavadoc EGL * See {@link GLBase} for more information. +ClassJavadoc EGL */ + # Javadoc for the WGL class ClassJavadoc WGL /** ClassJavadoc WGL * Provides access to the Windows-specific OpenGL vendor extensions. -ClassJavadoc WGL * See {@link GL} for more information. +ClassJavadoc WGL * See {@link GLBase} for more information. ClassJavadoc WGL */ # Javadoc for the GLX class ClassJavadoc GLX /** ClassJavadoc GLX * Provides access to the X11-specific OpenGL vendor extensions. -ClassJavadoc GLX * See {@link GL} for more information. +ClassJavadoc GLX * See {@link GLBase} for more information. ClassJavadoc GLX */ # Javadoc for the CGL class ClassJavadoc CGL /** ClassJavadoc CGL * Provides access to the MacOSX-specific OpenGL vendor extensions. -ClassJavadoc CGL * See {@link GL} for more information. +ClassJavadoc CGL * See {@link GLBase} for more information. ClassJavadoc CGL */ # Javadoc for the XVisualInfo class @@ -556,86 +573,9 @@ ClassJavadoc XVisualInfo */ # Custom code for querying extensions and exposing # wglAllocateMemoryNV/glXAllocateMemoryNV -CustomJavaCode GL /** -CustomJavaCode GL * Returns true if the specified OpenGL core- or extension-function can be -CustomJavaCode GL * used successfully through this GL instance given the current host (OpenGL -CustomJavaCode GL * client) and display (OpenGL server) configuration.

-CustomJavaCode GL * By "successfully" we mean that the function is both callable -CustomJavaCode GL * on the machine running the program and available on the current -CustomJavaCode GL * display.

-CustomJavaCode GL * -CustomJavaCode GL * In order to call a function successfully, the function must be both -CustomJavaCode GL * callable on the machine running the program and available on -CustomJavaCode GL * the display device that is rendering the output (note: on non-networked, -CustomJavaCode GL * single-display machines these two conditions are identical; on networked and/or -CustomJavaCode GL * multi-display machines this becomes more complicated). These conditions are -CustomJavaCode GL * met if the function is either part of the core OpenGL version supported by -CustomJavaCode GL * both the host and display, or it is an OpenGL extension function that both -CustomJavaCode GL * the host and display support.

-CustomJavaCode GL * -CustomJavaCode GL * A GL function is callable if it is successfully linked at runtime, -CustomJavaCode GL * hence the GLContext must be made current at least once. -CustomJavaCode GL * -CustomJavaCode GL * @param glFunctionName the name of the OpenGL function (e.g., use -CustomJavaCode GL * "glBindRenderbufferEXT" or "glBindRenderbuffer" to check if {@link -CustomJavaCode GL * #glBindRenderbuffer(int,int)} is available). -CustomJavaCode GL */ -CustomJavaCode GL public boolean isFunctionAvailable(String glFunctionName); - -CustomJavaCode GL /** -CustomJavaCode GL * Returns true if the specified OpenGL extension can be -CustomJavaCode GL * used successfully through this GL instance given the current host (OpenGL -CustomJavaCode GL * client) and display (OpenGL server) configuration.

-CustomJavaCode GL * -CustomJavaCode GL * @param glExtensionName the name of the OpenGL extension (e.g., -CustomJavaCode GL * "GL_ARB_vertex_program"). -CustomJavaCode GL */ -CustomJavaCode GL public boolean isExtensionAvailable(String glExtensionName); - -CustomJavaCode GL /** -CustomJavaCode GL * Provides platform-independent access to the wglAllocateMemoryNV / -CustomJavaCode GL * glXAllocateMemoryNV extension. -CustomJavaCode GL */ -CustomJavaCode GL public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3); - -CustomJavaCode GL /** Provides a platform-independent way to specify the minimum swap -CustomJavaCode GL interval for buffer swaps. An argument of 0 disables -CustomJavaCode GL sync-to-vertical-refresh completely, while an argument of 1 -CustomJavaCode GL causes the application to wait until the next vertical refresh -CustomJavaCode GL until swapping buffers. The default, which is platform-specific, -CustomJavaCode GL is usually either 0 or 1. This function is not guaranteed to -CustomJavaCode GL have an effect, and in particular only affects heavyweight -CustomJavaCode GL onscreen components. */ -CustomJavaCode GL public void setSwapInterval(int interval); - -CustomJavaCode GL /** -CustomJavaCode GL * Returns an object through which platform-specific OpenGL extensions -CustomJavaCode GL * (WGL, GLX, etc.) may be accessed. The data type of the returned -CustomJavaCode GL * object and its associated capabilities are undefined. Most -CustomJavaCode GL * applications will never need to call this method. It is highly -CustomJavaCode GL * recommended that any applications which do call this method perform -CustomJavaCode GL * all accesses on the returned object reflectively to guard -CustomJavaCode GL * themselves against changes to the implementation. -CustomJavaCode GL */ -CustomJavaCode GL public Object getPlatformGLExtensions(); - -CustomJavaCode GL /** -CustomJavaCode GL * Returns an object providing access to the specified OpenGL -CustomJavaCode GL * extension. This is intended to provide a mechanism for vendors who -CustomJavaCode GL * which to provide access to new OpenGL extensions without changing -CustomJavaCode GL * the public API of the core package. For example, a user may request -CustomJavaCode GL * access to extension "GL_VENDOR_foo" and receive back an object -CustomJavaCode GL * which implements a vendor-specified interface which can call the -CustomJavaCode GL * OpenGL extension functions corresponding to that extension. It is -CustomJavaCode GL * up to the vendor to specify both the extension name and Java API -CustomJavaCode GL * for accessing it, including which class or interface contains the -CustomJavaCode GL * functions. -CustomJavaCode GL * -CustomJavaCode GL *

-CustomJavaCode GL * -CustomJavaCode GL * Note: it is the intent to add new extensions as quickly as possible -CustomJavaCode GL * to the core GL API. Therefore it is unlikely that most vendors will -CustomJavaCode GL * use this extension mechanism, but it is being provided for -CustomJavaCode GL * completeness. -CustomJavaCode GL */ -CustomJavaCode GL public Object getExtension(String extensionName); +CustomJavaCode GL2GL3 /** +CustomJavaCode GL2GL3 * Provides platform-independent access to the wglAllocateMemoryNV / +CustomJavaCode GL2GL3 * glXAllocateMemoryNV extension. +CustomJavaCode GL2GL3 */ +CustomJavaCode GL2GL3 public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3); + diff --git a/make/config/jogl/gl-es1.cfg b/make/config/jogl/gl-es1.cfg index 02aae2860..35ea7f0ce 100755 --- a/make/config/jogl/gl-es1.cfg +++ b/make/config/jogl/gl-es1.cfg @@ -2,12 +2,12 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/es1 -ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/GLBase.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java # There are a few routines we don't handle yet Ignore glGetBufferPointervOES diff --git a/make/config/jogl/gl-es2.cfg b/make/config/jogl/gl-es2.cfg index 244f1944f..6a81c9376 100755 --- a/make/config/jogl/gl-es2.cfg +++ b/make/config/jogl/gl-es2.cfg @@ -2,9 +2,9 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/es2 -ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java Package javax.media.opengl Style InterfaceAndImpl diff --git a/make/config/jogl/gl-gl2-set.cfg b/make/config/jogl/gl-gl2-set.cfg new file mode 100644 index 000000000..bce9cc731 --- /dev/null +++ b/make/config/jogl/gl-gl2-set.cfg @@ -0,0 +1,13 @@ +# This .cfg file is used to generate the GL interface and implementing class. +JavaOutputDir ../../build-temp/gluegen-set + +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL2Set +Include gl-common-gl2.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg + +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff diff --git a/make/config/jogl/gl-gl2.cfg b/make/config/jogl/gl-gl2.cfg index 8dfe76758..55f5b9781 100644 --- a/make/config/jogl/gl-gl2.cfg +++ b/make/config/jogl/gl-gl2.cfg @@ -2,13 +2,14 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/gl2 -ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java -ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/GLBase.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2GL3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java Package javax.media.opengl Style InterfaceAndImpl @@ -17,12 +18,14 @@ Extends GL2 GLBase Extends GL2 GL Extends GL2 GL2ES1 Extends GL2 GL2ES2 +Extends GL2 GL2GL3 ImplPackage com.sun.opengl.impl.gl2 ImplJavaClass GL2Impl Implements GL2Impl GLBase Implements GL2Impl GL Implements GL2Impl GL2ES1 Implements GL2Impl GL2ES2 +Implements GL2Impl GL2GL3 Include gl-common-gl2.cfg Include gl-common-extensions.cfg Include gl-desktop.cfg diff --git a/make/config/jogl/gl-gl3.cfg b/make/config/jogl/gl-gl3.cfg index 2b521e30a..c5354cba4 100644 --- a/make/config/jogl/gl-gl3.cfg +++ b/make/config/jogl/gl-gl3.cfg @@ -2,9 +2,10 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/gl3 -ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2GL3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java Package javax.media.opengl Style InterfaceAndImpl @@ -12,11 +13,13 @@ JavaClass GL3 Extends GL3 GLBase Extends GL3 GL Extends GL3 GL2ES2 +Extends GL3 GL2GL3 ImplPackage com.sun.opengl.impl.gl3 ImplJavaClass GL3Impl Implements GL3Impl GLBase Implements GL3Impl GL Implements GL3Impl GL2ES2 +Implements GL3Impl GL2GL3 Include gl-common-gl2.cfg Include gl-common-extensions.cfg Include gl3-desktop.cfg diff --git a/make/config/jogl/gl-if-gl.cfg b/make/config/jogl/gl-if-gl.cfg index 46e11fdd4..1bba846e7 100755 --- a/make/config/jogl/gl-if-gl.cfg +++ b/make/config/jogl/gl-if-gl.cfg @@ -4,7 +4,7 @@ Style InterfaceOnly JavaClass GL Extends GL GLBase -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java HierarchicalNativeOutput false Include gl-common.cfg diff --git a/make/config/jogl/gl-if-gl2_es1.cfg b/make/config/jogl/gl-if-gl2_es1.cfg index d09ebcb30..6fe6b4b90 100755 --- a/make/config/jogl/gl-if-gl2_es1.cfg +++ b/make/config/jogl/gl-if-gl2_es1.cfg @@ -8,11 +8,11 @@ Extends GL2ES1 GLMatrixFunc Extends GL2ES1 GLPointerFunc Extends GL2ES1 GLLightingFunc -ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/GLBase.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java HierarchicalNativeOutput false Include gl-common.cfg diff --git a/make/config/jogl/gl-if-gl2_es2.cfg b/make/config/jogl/gl-if-gl2_es2.cfg index 5345c3ba1..63f96d906 100755 --- a/make/config/jogl/gl-if-gl2_es2.cfg +++ b/make/config/jogl/gl-if-gl2_es2.cfg @@ -5,8 +5,8 @@ JavaClass GL2ES2 Extends GL2ES2 GLBase Extends GL2ES2 GL -ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java HierarchicalNativeOutput false Include gl-common.cfg Include gl-common-extensions.cfg diff --git a/make/config/jogl/gl-if-gl2_gl3.cfg b/make/config/jogl/gl-if-gl2_gl3.cfg new file mode 100644 index 000000000..0afe5d5b5 --- /dev/null +++ b/make/config/jogl/gl-if-gl2_gl3.cfg @@ -0,0 +1,39 @@ +# This .cfg file is used to generate the GL interface and implementing class. +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL2GL3 +Extends GL2GL3 GLBase +Extends GL2GL3 GL +Extends GL2GL3 GL2ES2 + +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java + +ExtendedInterfaceSymbolsOnly ../build-temp/gluegen-set/javax/media/opengl/GL2Set.java + +HierarchicalNativeOutput false +Include gl-common.cfg +Include gl-common-extensions.cfg + +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl + +# +# Same name but different signature .. +# +# No collisions found .. good! + +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff + +# Inform the glue code generator of the association between #defines +# and functions and the extensions in which they are defined +GLHeader GL3/gl3.h +GLHeader GL3/gl3ext.h + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +Import java.io.PrintStream diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl2.java b/make/config/jogl/gl-impl-CustomJavaCode-gl2.java index b3410040b..5aec51fc7 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl2.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl2.java @@ -53,6 +53,10 @@ public final boolean isGL2ES2() { return true; } +public final boolean isGL2GL3() { + return true; +} + public final boolean hasGLSL() { return true; } @@ -85,6 +89,10 @@ public final GL2ES2 getGL2ES2() throws GLException { return this; } +public final GL2GL3 getGL2GL3() throws GLException { + return this; +} + public boolean isFunctionAvailable(String glFunctionName) { return _context.isFunctionAvailable(glFunctionName); } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java b/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java index d7b3de789..cb4cab175 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java @@ -56,6 +56,10 @@ public final boolean isGL2ES2() { return isGL2ES2; } +public final boolean isGL2GL3() { + return false; +} + public final boolean hasGLSL() { return isGL2ES2; } @@ -94,6 +98,10 @@ public final GL2ES2 getGL2ES2() throws GLException { throw new GLException("Not a GL2ES2 implementation"); } +public final GL2GL3 getGL2GL3() throws GLException { + throw new GLException("Not a GL2GL3 implementation"); +} + public boolean isFunctionAvailable(String glFunctionName) { return _context.isFunctionAvailable(glFunctionName); } @@ -115,14 +123,6 @@ public GLContext getContext() { private GLContextImpl _context; -/** - * Provides platform-independent access to the wglAllocateMemoryNV / - * glXAllocateMemoryNV extension. - */ -public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { - return _context.glAllocateMemoryNV(arg0, arg1, arg2, arg3); -} - public void setSwapInterval(int interval) { _context.setSwapInterval(interval); } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl3.java b/make/config/jogl/gl-impl-CustomJavaCode-gl3.java index aa1ef6575..a15964bcc 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl3.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl3.java @@ -53,6 +53,10 @@ public final boolean isGL2ES2() { return true; } +public final boolean isGL2GL3() { + return true; +} + public final boolean hasGLSL() { return true; } @@ -85,6 +89,10 @@ public final GL2ES2 getGL2ES2() throws GLException { return this; } +public final GL2GL3 getGL2GL3() throws GLException { + return this; +} + public boolean isFunctionAvailable(String glFunctionName) { return _context.isFunctionAvailable(glFunctionName); } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java index d349f8018..5141376df 100755 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java @@ -36,6 +36,10 @@ public final boolean isGL2ES2() { return false; } +public final boolean isGL2GL3() { + return false; +} + public final boolean hasGLSL() { return false; } @@ -68,6 +72,10 @@ public final GL2ES2 getGL2ES2() throws GLException { throw new GLException("Not a GL2ES2 implementation"); } +public final GL2GL3 getGL2GL3() throws GLException { + throw new GLException("Not a GL2GL3 implementation"); +} + public boolean isFunctionAvailable(String glFunctionName) { return _context.isFunctionAvailable(glFunctionName); } @@ -89,14 +97,6 @@ public GLContext getContext() { private GLContextImpl _context; -/** - * Provides platform-independent access to the wglAllocateMemoryNV / - * glXAllocateMemoryNV extension. - */ -public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { - return _context.glAllocateMemoryNV(arg0, arg1, arg2, arg3); -} - public void setSwapInterval(int interval) { _context.setSwapInterval(interval); } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java index 28edd7a63..b53715ae0 100755 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java @@ -40,6 +40,10 @@ public final boolean isGL2ES2() { return true; } +public final boolean isGL2GL3() { + return false; +} + public final boolean hasGLSL() { return true; } @@ -72,6 +76,10 @@ public final GL2ES2 getGL2ES2() throws GLException { return this; } +public final GL2GL3 getGL2GL3() throws GLException { + throw new GLException("Not a GL2GL3 implementation"); +} + public boolean isFunctionAvailable(String glFunctionName) { return _context.isFunctionAvailable(glFunctionName); } @@ -93,14 +101,6 @@ public GLContext getContext() { private GLContextImpl _context; -/** - * Provides platform-independent access to the wglAllocateMemoryNV / - * glXAllocateMemoryNV extension. - */ -public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { - return _context.glAllocateMemoryNV(arg0, arg1, arg2, arg3); -} - public void setSwapInterval(int interval) { _context.setSwapInterval(interval); } diff --git a/make/config/jogl/glxext.cfg b/make/config/jogl/glxext.cfg index 9688a9436..ea4b6fe47 100755 --- a/make/config/jogl/glxext.cfg +++ b/make/config/jogl/glxext.cfg @@ -9,7 +9,7 @@ JavaClass GLXExt ImplPackage com.sun.opengl.impl.x11.glx ImplJavaClass GLXExtImpl -ExtendedInterfaceSymbols ../build-temp/gensrc/classes/com/sun/opengl/impl/x11/glx/GLX.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/sun/opengl/impl/x11/glx/GLX.java Include gl-common-gl2.cfg Include gl-desktop.cfg diff --git a/make/doc/jogl/spec-overview.html b/make/doc/jogl/spec-overview.html index 11074e601..4ee902719 100644 --- a/make/doc/jogl/spec-overview.html +++ b/make/doc/jogl/spec-overview.html @@ -11,7 +11,7 @@ This specification, an optional set of packages, describes the Java(TM) bindings to the native OpenGL(R) 3D graphics library profiles:

    -
  • Desktop OpenGL 1.x, 2.y and 3.0, with x >= 5 and y >= 0
  • +
  • Desktop OpenGL 1.x, 2.y and 3.0, with x >= 3 and y >= 0
  • Desktop OpenGL 3.x, with x >= 1
  • Embedded OpenGL ES 1.x, with x >= 0
  • Embedded OpenGL ES 2.x, with x >= 0
  • @@ -60,7 +60,7 @@ excluded.
  • {@link javax.media.opengl.GL3 javax.media.opengl.GL3} interface

    This interface contains all core desktop OpenGL methods starting from 3.1, -inclusive, as well as most of it's extensions defined at the +inclusive - forward compatible only, as well as most of it's extensions defined at the time of this specification.
    Future extensions will be added with a maintenance update

  • @@ -101,7 +101,12 @@ time of this specification.
  • {@link javax.media.opengl.GL2ES2 javax.media.opengl.GL2ES2} interface

    Interface containing the common subset of GL3, GL2 and GLES2.
    - This interface reflects only the programmable shader functionality of OpenGL

  • + This interface reflects only the programmable shader functionality of desktop and embedded OpenGL
    + +
  • {@link javax.media.opengl.GL2GL3 javax.media.opengl.GL2GL3} interface
    +
    + Interface containing the common subset of GL3 and GL2.
    + This interface reflects only the programmable shader functionality of desktop OpenGL


@@ -500,7 +505,7 @@ http://www.khronos.org/registry/gles/
  • Proposed Final Draft Review, February/March 2006
  • 1.0.0 Final Release, September 2006
  • 1.1.0 Maintenance Release, April 2007 -
  • 1.2.0 Maintenance Release, June 2009 +
  • 2.0.0 Maintenance Release, July 2009

    diff --git a/make/lsGL2toGL3_commons.sh b/make/lsGL2toGL3_commons.sh index cccfa734c..7f2a276de 100644 --- a/make/lsGL2toGL3_commons.sh +++ b/make/lsGL2toGL3_commons.sh @@ -10,7 +10,7 @@ fi idir=$BUILDDIR/jogl/gensrc/classes/javax/media/opengl echo GL2 to GL3 enums -sort $idir/GL2.java $idir/GL3.java $idir/GL2ES2.java | uniq -d | grep GL_ | awk ' { print $5 } ' +sort $idir/GL2.java $idir/GL3.java $idir/GL2ES2.java $idir/GL2GL3.java | uniq -d | grep GL_ | awk ' { print $5 } ' echo GL2 to GL3 functions -sort $idir/GL2.java $idir/GL3.java $idir/GL2ES2.java | uniq -d | grep "public [a-z0-9_]* gl" +sort $idir/GL2.java $idir/GL3.java $idir/GL2ES2.java $idir/GL2GL3.java | uniq -d | grep "public [a-z0-9_]* gl" diff --git a/make/lsGL2toGL3_unique.sh b/make/lsGL2toGL3_unique.sh new file mode 100644 index 000000000..20d821332 --- /dev/null +++ b/make/lsGL2toGL3_unique.sh @@ -0,0 +1,16 @@ +#! /bin/sh + +BUILDDIR=$1 +shift +if [ -z "$BUILDDIR" ] ; then + echo "usage $0 " + exit 1 +fi + +idir=$BUILDDIR/jogl/gensrc/classes/javax/media/opengl + +echo GL2 to GL3 enums +sort $idir/GL2.java $idir/GL3.java $idir/GL2ES2.java $idir/GL2GL3.java | uniq -u | grep GL_ | awk ' { print $5 } ' + +echo GL2 to GL3 functions +sort $idir/GL2.java $idir/GL3.java $idir/GL2ES2.java $idir/GL2GL3.java | uniq -u | grep "public [a-z0-9_]* gl" diff --git a/make/stub_includes/opengl/GL/glext.h b/make/stub_includes/opengl/GL/glext.h index e6c6fab40..1016638dd 100644 --- a/make/stub_includes/opengl/GL/glext.h +++ b/make/stub_includes/opengl/GL/glext.h @@ -4475,7 +4475,7 @@ GLAPI void APIENTRY glEndTransformFeedback (void); GLAPI void APIENTRY glBindBufferRange (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr); GLAPI void APIENTRY glBindBufferBase (GLenum, GLuint, GLuint); GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint, GLsizei, const GLchar **, GLenum); -GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint, GLuint, GLint *); +GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *); GLAPI void APIENTRY glClampColor (GLenum, GLenum); GLAPI void APIENTRY glBeginConditionalRender (GLuint, GLenum); GLAPI void APIENTRY glEndConditionalRender (void); @@ -4534,7 +4534,7 @@ typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLint *location); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void); @@ -5255,10 +5255,10 @@ typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divi #ifndef GL_ARB_map_buffer_range #define GL_ARB_map_buffer_range 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMapBufferRange (GLenum, GLintptr, GLsizeiptr, GLbitfield); +GLAPI GLvoid* APIENTRY glMapBufferRange (GLenum, GLintptr, GLsizeiptr, GLbitfield); GLAPI void APIENTRY glFlushMappedBufferRange (GLenum, GLintptr, GLsizeiptr); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); #endif diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java index efd2eedd1..7b59344cc 100644 --- a/src/jogl/classes/javax/media/opengl/GLBase.java +++ b/src/jogl/classes/javax/media/opengl/GLBase.java @@ -7,9 +7,53 @@ package javax.media.opengl; import java.nio.*; /** - * The base interface from which all GL profiles derive, providing - * checked conversion down to concrete profiles, and access to the - * OpenGL context associated with the GL. + *

    The base interface from which all GL profiles derive, providing + * checked conversion down to concrete profiles, access to the + * OpenGL context associated with the GL and extension/function + * availability queries as described below.

    + * + *

    While the APIs for vendor extensions are unconditionally + * exposed, the underlying functions may not be present. The method + * {@link #isFunctionAvailable} should be used to query the + * availability of any non-core function before it is used for the + * first time; for example, + * gl.isFunctionAvailable("glProgramStringARB"). On + * certain platforms (Windows in particular), the most "core" + * functionality is only OpenGL 1.1, so in theory any routines first + * exposed in OpenGL 1.2, 1.3, and 1.4, 1.5, or 2.0 as well as vendor + * extensions should all be queried. Calling an unavailable function + * will cause a {@link GLException} to be raised.

    + * + * {@link #isExtensionAvailable} may also be used to determine whether + * a specific extension is available before calling the routines or + * using the functionality it exposes: for example, + * gl.isExtensionAvailable("GL_ARB_vertex_program");. + * However, in this case it is up to the end user to know which + * routines or functionality are associated with which OpenGL + * extensions. It may also be used to test for the availability of a + * particular version of OpenGL: for example, + * gl.isExtensionAvailable("GL_VERSION_1_5");. + * + *

    Exceptions to the window system extension naming rules: + * + *

      + * + *
    • The memory allocators for the NVidia vertex_array_range (VAR) + * extension, in particular wglAllocateMemoryNV / + * glXAllocateMemoryNV and associated routines. {@link + * #glAllocateMemoryNV} has been provided for window system-independent + * access to VAR. {@link #isFunctionAvailable} will translate an argument + * of "glAllocateMemoryNV" or "glFreeMemoryNV" into the appropriate + * window system-specific name.

      + * + *
    • WGL_ARB_pbuffer, WGL_ARB_pixel_format, and other + * platform-specific pbuffer functionality; the availability of + * pbuffers can be queried on Windows, X11 and Mac OS X platforms by + * querying {@link #isExtensionAvailable} with an argument of + * "GL_ARB_pbuffer" or "GL_ARB_pixel_format". + * + *

    + * */ public interface GLBase { @@ -63,6 +107,12 @@ public interface GLBase { */ public boolean isGL2ES2(); + /** + * Indicates whether this GL object conforms to the GL2GL3 compatible profile. + * @return whether this GL object conforms to the GL2GL3 profile + */ + public boolean isGL2GL3(); + /** Indicates whether this GL object supports GLSL. */ public boolean hasGLSL(); @@ -116,14 +166,100 @@ public interface GLBase { public GL2ES2 getGL2ES2() throws GLException; /** - * Returns the GLContext with which this GL object is associated. - * @return the GLContext with which this GL object is associated + * Casts this object to the GL2GL3 interface. + * @return this object cast to the GL2GL3 interface + * @throws GLException if this GLObject is not a GL2GL3 implementation */ - public GLContext getContext(); + public GL2GL3 getGL2GL3() throws GLException; /** * Returns the GLProfile with which this GL object is associated. * @return the GLProfile with which this GL object is associated */ public GLProfile getGLProfile(); + + /** + * Returns the GLContext with which this GL object is associated. + * @return the GLContext with which this GL object is associated + */ + public GLContext getContext(); + + /** + * Returns true if the specified OpenGL core- or extension-function can be + * used successfully through this GL instance given the current host (OpenGL + * client) and display (OpenGL server) configuration.

    + * By "successfully" we mean that the function is both callable + * on the machine running the program and available on the current + * display.

    + * + * In order to call a function successfully, the function must be both + * callable on the machine running the program and available on + * the display device that is rendering the output (note: on non-networked, + * single-display machines these two conditions are identical; on networked and/or + * multi-display machines this becomes more complicated). These conditions are + * met if the function is either part of the core OpenGL version supported by + * both the host and display, or it is an OpenGL extension function that both + * the host and display support.

    + * + * A GL function is callable if it is successfully linked at runtime, + * hence the GLContext must be made current at least once. + * + * @param glFunctionName the name of the OpenGL function (e.g., use + * "glBindRenderbufferEXT" or "glBindRenderbuffer" to check if {@link + * #glBindRenderbuffer(int,int)} is available). + */ + public boolean isFunctionAvailable(String glFunctionName); + + /** + * Returns true if the specified OpenGL extension can be + * used successfully through this GL instance given the current host (OpenGL + * client) and display (OpenGL server) configuration.

    + * + * @param glExtensionName the name of the OpenGL extension (e.g., + * "GL_ARB_vertex_program"). + */ + public boolean isExtensionAvailable(String glExtensionName); + + /** Provides a platform-independent way to specify the minimum swap + interval for buffer swaps. An argument of 0 disables + sync-to-vertical-refresh completely, while an argument of 1 + causes the application to wait until the next vertical refresh + until swapping buffers. The default, which is platform-specific, + is usually either 0 or 1. This function is not guaranteed to + have an effect, and in particular only affects heavyweight + onscreen components. */ + public void setSwapInterval(int interval); + + /** + * Returns an object through which platform-specific OpenGL extensions + * (EGL, GLX, WGL, etc.) may be accessed. The data type of the returned + * object and its associated capabilities are undefined. Most + * applications will never need to call this method. It is highly + * recommended that any applications which do call this method perform + * all accesses on the returned object reflectively to guard + * themselves against changes to the implementation. + */ + public Object getPlatformGLExtensions(); + + /** + * Returns an object providing access to the specified OpenGL + * extension. This is intended to provide a mechanism for vendors who + * wish to provide access to new OpenGL extensions without changing + * the public API of the core package. For example, a user may request + * access to extension "GL_VENDOR_foo" and receive back an object + * which implements a vendor-specified interface which can call the + * OpenGL extension functions corresponding to that extension. It is + * up to the vendor to specify both the extension name and Java API + * for accessing it, including which class or interface contains the + * functions. + * + *

    + * + * Note: it is the intent to add new extensions as quickly as possible + * to the core GL API. Therefore it is unlikely that most vendors will + * use this extension mechanism, but it is being provided for + * completeness. + */ + public Object getExtension(String extensionName); } + diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 6dab57469..8b23bed04 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -78,10 +78,13 @@ public class GLProfile implements Cloneable { /** The intersection of the desktop GL3, GL2 and embedded ES2 profile */ public static final String GL2ES2 = "GL2ES2"; + /** The intersection of the desktop GL3 and GL2 profile */ + public static final String GL2GL3 = "GL2GL3"; + /** - * All GL Profiles in the order of default detection: GL2, GL2ES2, GL2ES1, GLES2, GLES1, GL3 + * All GL Profiles in the order of default detection: GL2, GL2ES2, GL2ES1, GLES2, GLES1, GL2GL3, GL3 */ - public static final String[] GL_PROFILE_LIST_ALL = new String[] { GL2, GL2ES2, GL2ES1, GLES2, GLES1, GL3 }; + public static final String[] GL_PROFILE_LIST_ALL = new String[] { GL2, GL2ES2, GL2ES1, GLES2, GLES1, GL2GL3, GL3 }; /** * All GL2ES2 Profiles in the order of default detection: GL2ES2, GL2, GLES2, GL3 @@ -273,6 +276,11 @@ public class GLProfile implements Cloneable { return GL2ES2.equals(profile) || isGL2() || isGL3() || isGLES2() ; } + /** Indicates whether this profile is capable os GL2GL3. */ + public final boolean isGL2GL3() { + return GL2GL3.equals(profile) || isGL2() || isGL3() ; + } + /** Indicates whether this profile uses the native OpenGL ES1 implementations. */ public final boolean usesNativeGLES1() { return GLES1.equals(profileImpl) || GL2ES1.equals(profileImpl) ; @@ -781,6 +789,8 @@ public class GLProfile implements Cloneable { return GL3; } else if(GL2.equals(profile) && hasGL2Impl) { return GL2; + } else if(GL2GL3.equals(profile) && hasGL2Impl) { + return GL2; } else if(GLES2.equals(profile) && hasGLES2Impl) { return GLES2; } else if(GLES1.equals(profile) && hasGLES1Impl) { diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index dd2a487e7..7b942b358 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -1322,16 +1322,16 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { " with width " + width[0] + ", height " + height[0]); } - gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, frameBufferDepthBuffer[0]); + gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, frameBufferDepthBuffer[0]); // FIXME: may need a loop here like in Java2D - gl.glRenderbufferStorage(GL2.GL_RENDERBUFFER, GL2.GL_DEPTH_COMPONENT24, width[0], height[0]); + gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, GL2GL3.GL_DEPTH_COMPONENT24, width[0], height[0]); gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, 0); createNewDepthBuffer = false; } gl.glBindTexture(fboTextureTarget, 0); - gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, frameBuffer[0]); + gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, frameBuffer[0]); if (fbObjectWorkarounds) { // Hook up the color and depth buffer attachment points for this framebuffer @@ -1435,29 +1435,29 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { j2dContext.makeCurrent(); GL gl = j2dContext.getGL(); - if ((getGLInteger(gl, GL2.GL_RED_BITS) < offscreenCaps.getRedBits()) || - (getGLInteger(gl, GL2.GL_GREEN_BITS) < offscreenCaps.getGreenBits()) || - (getGLInteger(gl, GL2.GL_BLUE_BITS) < offscreenCaps.getBlueBits()) || - // (getGLInteger(gl, GL2.GL_ALPHA_BITS) < offscreenCaps.getAlphaBits()) || + if ((getGLInteger(gl, GL.GL_RED_BITS) < offscreenCaps.getRedBits()) || + (getGLInteger(gl, GL.GL_GREEN_BITS) < offscreenCaps.getGreenBits()) || + (getGLInteger(gl, GL.GL_BLUE_BITS) < offscreenCaps.getBlueBits()) || + // (getGLInteger(gl, GL.GL_ALPHA_BITS) < offscreenCaps.getAlphaBits()) || (getGLInteger(gl, GL2.GL_ACCUM_RED_BITS) < offscreenCaps.getAccumRedBits()) || (getGLInteger(gl, GL2.GL_ACCUM_GREEN_BITS) < offscreenCaps.getAccumGreenBits()) || (getGLInteger(gl, GL2.GL_ACCUM_BLUE_BITS) < offscreenCaps.getAccumBlueBits()) || (getGLInteger(gl, GL2.GL_ACCUM_ALPHA_BITS) < offscreenCaps.getAccumAlphaBits()) || // (getGLInteger(gl, GL2.GL_DEPTH_BITS) < offscreenCaps.getDepthBits()) || - (getGLInteger(gl, GL2.GL_STENCIL_BITS) < offscreenCaps.getStencilBits())) { + (getGLInteger(gl, GL.GL_STENCIL_BITS) < offscreenCaps.getStencilBits())) { if (DEBUG) { System.err.println("GLJPanel: Falling back to pbuffer-based support because Java2D context insufficient"); System.err.println(" Available Required"); - System.err.println("GL_RED_BITS " + getGLInteger(gl, GL2.GL_RED_BITS) + " " + offscreenCaps.getRedBits()); - System.err.println("GL_GREEN_BITS " + getGLInteger(gl, GL2.GL_GREEN_BITS) + " " + offscreenCaps.getGreenBits()); - System.err.println("GL_BLUE_BITS " + getGLInteger(gl, GL2.GL_BLUE_BITS) + " " + offscreenCaps.getBlueBits()); - System.err.println("GL_ALPHA_BITS " + getGLInteger(gl, GL2.GL_ALPHA_BITS) + " " + offscreenCaps.getAlphaBits()); + System.err.println("GL_RED_BITS " + getGLInteger(gl, GL.GL_RED_BITS) + " " + offscreenCaps.getRedBits()); + System.err.println("GL_GREEN_BITS " + getGLInteger(gl, GL.GL_GREEN_BITS) + " " + offscreenCaps.getGreenBits()); + System.err.println("GL_BLUE_BITS " + getGLInteger(gl, GL.GL_BLUE_BITS) + " " + offscreenCaps.getBlueBits()); + System.err.println("GL_ALPHA_BITS " + getGLInteger(gl, GL.GL_ALPHA_BITS) + " " + offscreenCaps.getAlphaBits()); System.err.println("GL_ACCUM_RED_BITS " + getGLInteger(gl, GL2.GL_ACCUM_RED_BITS) + " " + offscreenCaps.getAccumRedBits()); System.err.println("GL_ACCUM_GREEN_BITS " + getGLInteger(gl, GL2.GL_ACCUM_GREEN_BITS) + " " + offscreenCaps.getAccumGreenBits()); System.err.println("GL_ACCUM_BLUE_BITS " + getGLInteger(gl, GL2.GL_ACCUM_BLUE_BITS) + " " + offscreenCaps.getAccumBlueBits()); System.err.println("GL_ACCUM_ALPHA_BITS " + getGLInteger(gl, GL2.GL_ACCUM_ALPHA_BITS) + " " + offscreenCaps.getAccumAlphaBits()); - System.err.println("GL_DEPTH_BITS " + getGLInteger(gl, GL2.GL_DEPTH_BITS) + " " + offscreenCaps.getDepthBits()); - System.err.println("GL_STENCIL_BITS " + getGLInteger(gl, GL2.GL_STENCIL_BITS) + " " + offscreenCaps.getStencilBits()); + System.err.println("GL_DEPTH_BITS " + getGLInteger(gl, GL.GL_DEPTH_BITS) + " " + offscreenCaps.getDepthBits()); + System.err.println("GL_STENCIL_BITS " + getGLInteger(gl, GL.GL_STENCIL_BITS) + " " + offscreenCaps.getStencilBits()); } isInitialized = false; backend = null; @@ -1587,7 +1587,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { if (!checkedGLVendor) { checkedGLVendor = true; - String vendor = gl.glGetString(GL2.GL_VENDOR); + String vendor = gl.glGetString(GL.GL_VENDOR); if ((vendor != null) && vendor.startsWith("ATI")) { 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 c8436b928..10e70baa0 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 @@ -56,7 +56,7 @@ public class BCEGLWindow extends Window { if (config == null) { throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); } - setSize(getScreen().getWidth(), getScreen().getHeight()); + setSizeImpl(getScreen().getWidth(), getScreen().getHeight()); } protected void closeNative() { @@ -79,6 +79,10 @@ public class BCEGLWindow extends Window { } public void setSize(int width, int height) { + System.err.println("setSize "+width+"x"+height+" n/a in BroadcomEGL"); + } + + void setSizeImpl(int width, int height) { if(0!=windowHandle) { // n/a in BroadcomEGL System.err.println("setSize n/a in BroadcomEGL with realized window"); -- cgit v1.2.3 From 8883fa885e68cd21e8b8cd3343db0580913aebdf Mon Sep 17 00:00:00 2001 From: sg215889 Date: Wed, 29 Jul 2009 09:49:33 -0700 Subject: 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 --- doc/TODO.txt | 11 ---- doxygen/doxygen-all-pub.cfg | 2 +- make/config/jogl/gl-if-CustomJavaCode-gl.java | 37 +++++++++++++ make/lsGL23toGL2ES1_commons.sh | 18 +++++++ .../com/sun/opengl/impl/GLDrawableImpl.java | 9 ++++ .../sun/opengl/impl/egl/EGLOnscreenDrawable.java | 2 +- .../sun/opengl/impl/egl/EGLPbufferDrawable.java | 1 + .../impl/macosx/cgl/MacOSXOnscreenCGLContext.java | 2 +- .../impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java | 2 +- .../impl/macosx/cgl/MacOSXPbufferCGLDrawable.java | 2 +- .../windows/wgl/WindowsOffscreenWGLDrawable.java | 2 +- .../windows/wgl/WindowsPbufferWGLDrawable.java | 2 +- .../impl/windows/wgl/WindowsWGLDrawable.java | 63 +++++++++++----------- .../sun/opengl/impl/x11/glx/X11GLXDrawable.java | 31 +++++------ .../impl/x11/glx/X11OffscreenGLXDrawable.java | 2 +- .../opengl/impl/x11/glx/X11PbufferGLXDrawable.java | 2 +- .../com/sun/nativewindow/impl/NullWindow.java | 6 +++ .../com/sun/nativewindow/impl/jawt/JAWTWindow.java | 6 +++ .../javax/media/nativewindow/NativeWindow.java | 18 +++++++ src/newt/classes/com/sun/javafx/newt/Window.java | 6 +++ .../com/sun/javafx/newt/opengl/GLWindow.java | 13 +++++ .../javafx/newt/opengl/broadcom/BCEGLWindow.java | 13 ++++- src/newt/native/BroadcomEGL.c | 17 ++++-- 23 files changed, 191 insertions(+), 76 deletions(-) create mode 100644 make/lsGL23toGL2ES1_commons.sh (limited to 'src/newt/classes/com/sun/javafx') 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 " + 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"); +} + -- cgit v1.2.3 From d0e39bee266f0b715fe7ef711faff4783835c3d5 Mon Sep 17 00:00:00 2001 From: sg215889 Date: Wed, 29 Jul 2009 10:49:00 -0700 Subject: Add BroadcomEGL verbose messages --- .../javafx/newt/opengl/broadcom/BCEGLDisplay.java | 2 +- src/newt/native/BroadcomEGL.c | 25 +++++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'src/newt/classes/com/sun/javafx') diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java index abf9859c5..dbe126c91 100644 --- a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java +++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java @@ -72,7 +72,7 @@ public class BCEGLDisplay extends Display { } protected void dispatchMessages() { - DispatchMessages(); + // n/a .. DispatchMessages(); } private native long CreateDisplay(int width, int height); diff --git a/src/newt/native/BroadcomEGL.c b/src/newt/native/BroadcomEGL.c index 764fa9b16..7ef73446e 100755 --- a/src/newt/native/BroadcomEGL.c +++ b/src/newt/native/BroadcomEGL.c @@ -58,7 +58,7 @@ EGLSurface EGLUtil_CreateWindowByNative( EGLDisplay eglDisplay, /* bool */ GLuin void EGLUtil_DestroyWindow( EGLDisplay eglDisplay, EGLSurface eglSurface ); void EGLUtil_SwapWindow( EGLDisplay eglDisplay, EGLSurface eglSurface ); -// #define VERBOSE_ON 1 +#define VERBOSE_ON 1 #ifdef VERBOSE_ON #define DBG_PRINT(...) fprintf(stdout, __VA_ARGS__) @@ -100,7 +100,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLDisplay_Des EGLDisplay dpy = (EGLDisplay)(intptr_t)display; (void) env; (void) obj; + DBG_PRINT( "[DestroyDisplay] dpy %p\n", dpy); + EGLUtil_DestroyDisplay(dpy); + + DBG_PRINT( "[DestroyDisplay] X\n"); } /** @@ -130,6 +134,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_Cre fprintf(stderr, "[RealizeWindow] invalid display connection..\n"); return 0; } + DBG_PRINT( "[RealizeWindow.Create] dpy %p %ux%u\n", dpy, uiWidth, uiHeight); window = EGLUtil_CreateWindowByNative( dpy, chromaKey, &uiWidth, &uiHeight ); @@ -144,16 +149,20 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_Cre return 0; } (*env)->CallVoidMethod(env, obj, windowCreatedID, (jint) cfgID, (jint)uiWidth, (jint)uiHeight); - DBG_PRINT( "[RealizeWindow.Create] ok: %p, cfgid %d, %ux%u\n", window, cfgID, uiWidth, uiHeight); + DBG_PRINT( "[RealizeWindow.Create] ok: win %p, cfgid %d, %ux%u\n", window, cfgID, uiWidth, uiHeight); // release and destroy already made context .. EGLContext ctx = eglGetCurrentContext(); + DBG_PRINT( "[RealizeWindow.Create] ctx %p\n", ctx); eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - eglDestroyContext(dpy, ctx); + DBG_PRINT( "[RealizeWindow.Create] 2\n"); + eglDestroyContext(dpy, ctx); // culprit ? FIXME ? + DBG_PRINT( "[RealizeWindow.Create] X\n"); + return (jlong) (intptr_t) window; } @@ -162,9 +171,12 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_Clos { EGLDisplay dpy = (EGLDisplay) (intptr_t) display; EGLSurface surf = (EGLSurface) (intptr_t) window; + + DBG_PRINT( "[CloseWindow] dpy %p, win %p\n", dpy, surf); + EGLUtil_DestroyWindow(dpy, surf); - DBG_PRINT( "[CloseWindow]\n"); + DBG_PRINT( "[CloseWindow] X\n"); } JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_SwapWindow @@ -172,8 +184,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_Swap { EGLDisplay dpy = (EGLDisplay) (intptr_t) display; EGLSurface surf = (EGLSurface) (intptr_t) window; + + DBG_PRINT( "[SwapWindow] dpy %p, win %p\n", dpy, surf); + EGLUtil_SwapWindow( dpy, surf ); - DBG_PRINT( "[SwapWindow]\n"); + DBG_PRINT( "[SwapWindow] X\n"); } -- cgit v1.2.3 From cd0ec06b5e8a5ec39c8162e87d23c935b506021e Mon Sep 17 00:00:00 2001 From: sg215889 Date: Thu, 30 Jul 2009 09:21:39 -0700 Subject: Fix: Check if windowHandle is already created --- .../com/sun/javafx/newt/opengl/kd/KDWindow.java | 8 ++++-- .../com/sun/javafx/newt/windows/WindowsWindow.java | 32 ++++++++++++---------- .../classes/com/sun/javafx/newt/x11/X11Window.java | 6 ++-- 3 files changed, 26 insertions(+), 20 deletions(-) (limited to 'src/newt/classes/com/sun/javafx') diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/kd/KDWindow.java b/src/newt/classes/com/sun/javafx/newt/opengl/kd/KDWindow.java index df0134c8e..1265fa9e2 100755 --- a/src/newt/classes/com/sun/javafx/newt/opengl/kd/KDWindow.java +++ b/src/newt/classes/com/sun/javafx/newt/opengl/kd/KDWindow.java @@ -79,7 +79,7 @@ public class KDWindow extends Window { } public void setVisible(boolean visible) { - if(this.visible!=visible) { + if(0!=eglWindowHandle && this.visible!=visible) { this.visible=visible; setVisible0(eglWindowHandle, visible); if ( 0==windowHandle ) { @@ -93,7 +93,9 @@ public class KDWindow extends Window { } public void setSize(int width, int height) { - setSize0(eglWindowHandle, width, height); + if(0!=eglWindowHandle) { + setSize0(eglWindowHandle, width, height); + } } public void setPosition(int x, int y) { @@ -102,7 +104,7 @@ public class KDWindow extends Window { } public boolean setFullscreen(boolean fullscreen) { - if(this.fullscreen!=fullscreen) { + if(0!=eglWindowHandle && this.fullscreen!=fullscreen) { this.fullscreen=fullscreen; if(this.fullscreen) { setFullScreen0(eglWindowHandle, true); diff --git a/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java b/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java index c42aaa6d9..a173baff0 100755 --- a/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java +++ b/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java @@ -54,7 +54,7 @@ public class WindowsWindow extends Window { } public long getSurfaceHandle() { - if (hdc == 0) { + if (hdc == 0 && 0!=windowHandle) { hdc = GetDC(windowHandle); hmon = MonitorFromWindow(windowHandle); if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { @@ -67,21 +67,23 @@ public class WindowsWindow extends Window { } public boolean hasDeviceChanged() { - long _hmon = MonitorFromWindow(windowHandle); - if (hmon != _hmon) { - if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { - Exception e = new Exception("!!! Window Device Changed "+Thread.currentThread().getName()+ - ", HMON 0x"+Long.toHexString(hmon)+" -> 0x"+Long.toHexString(_hmon)); - e.printStackTrace(); + if(0!=windowHandle) { + long _hmon = MonitorFromWindow(windowHandle); + if (hmon != _hmon) { + if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { + Exception e = new Exception("!!! Window Device Changed "+Thread.currentThread().getName()+ + ", HMON 0x"+Long.toHexString(hmon)+" -> 0x"+Long.toHexString(_hmon)); + e.printStackTrace(); + } + hmon = _hmon; + return true; } - hmon = _hmon; - return true; } return false; } public void disposeSurfaceHandle() { - if (hdc != 0) { + if (0!=hdc && 0!=windowHandle) { ReleaseDC(windowHandle, hdc); hdc=0; if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { @@ -124,7 +126,7 @@ public class WindowsWindow extends Window { } public void setVisible(boolean visible) { - if(this.visible!=visible) { + if(this.visible!=visible && 0!=windowHandle) { this.visible=visible; setVisible0(windowHandle, visible); } @@ -132,7 +134,7 @@ public class WindowsWindow extends Window { // @Override public void setSize(int width, int height) { - if (width != this.width || this.height != height) { + if (0!=windowHandle && (width != this.width || this.height != height)) { if(!fullscreen) { nfs_width=width; nfs_height=height; @@ -145,7 +147,7 @@ public class WindowsWindow extends Window { //@Override public void setPosition(int x, int y) { - if (this.x != x || this.y != y) { + if (0!=windowHandle && (this.x != x || this.y != y)) { if(!fullscreen) { nfs_x=x; nfs_y=y; @@ -157,7 +159,7 @@ public class WindowsWindow extends Window { } public boolean setFullscreen(boolean fullscreen) { - if(this.fullscreen!=fullscreen) { + if(0!=windowHandle && (this.fullscreen!=fullscreen)) { int x,y,w,h; this.fullscreen=fullscreen; if(fullscreen) { @@ -191,7 +193,7 @@ public class WindowsWindow extends Window { if (title == null) { title = ""; } - if (!title.equals(getTitle())) { + if (0!=windowHandle && !title.equals(getTitle())) { super.setTitle(title); setTitle(windowHandle, title); } diff --git a/src/newt/classes/com/sun/javafx/newt/x11/X11Window.java b/src/newt/classes/com/sun/javafx/newt/x11/X11Window.java index bd6bb42c2..380c968d1 100755 --- a/src/newt/classes/com/sun/javafx/newt/x11/X11Window.java +++ b/src/newt/classes/com/sun/javafx/newt/x11/X11Window.java @@ -84,7 +84,7 @@ public class X11Window extends Window { } public void setVisible(boolean visible) { - if(this.visible!=visible) { + if(0!=windowHandle && this.visible!=visible) { this.visible=visible; setVisible0(getDisplayHandle(), windowHandle, visible); clearEventMask(); @@ -96,6 +96,7 @@ public class X11Window extends Window { } public void setSize(int width, int height) { + if(0==windowHandle) return; if(!fullscreen) { nfs_width=width; nfs_height=height; @@ -104,6 +105,7 @@ public class X11Window extends Window { } public void setPosition(int x, int y) { + if(0==windowHandle) return; if(!fullscreen) { nfs_x=x; nfs_y=y; @@ -112,7 +114,7 @@ public class X11Window extends Window { } public boolean setFullscreen(boolean fullscreen) { - if(this.fullscreen!=fullscreen) { + if(0!=windowHandle && this.fullscreen!=fullscreen) { int x,y,w,h; this.fullscreen=fullscreen; if(fullscreen) { -- cgit v1.2.3 From 786b056afb90311a8c06a57fc24f242f8df713e1 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 31 Jul 2009 11:52:46 -0700 Subject: Gluegen: - Fix array element type name and const qualifier JOGL: - GL3: Set ArgumentIsString for GL3.1 methods - JAR file creation: Add 'filesonly' option - GLU: Static check of available impl., better fallback for GL2 without GLUgl2. - WGL: (Performance + Java2D/GL FBO works again) - Refactor WGL_ARB_pixel_format's HDC -> GLCapabilities: HDC2Caps - Revert change where we always create a dummy drawable/context for WGL selection (HDC2Caps). In case of no multisampling, use PFD2Caps only. - Update config using HDC2Caps (WGL_ARB_pixel_format) after context creation, if not done already -> updateCapabilitiesByWGL(). - profile.jogl: Add debug jars --- etc/profile.jogl | 14 +- make/build-jogl.xml | 80 +++++------ make/build-nativewindow.xml | 18 +-- make/build-newt.xml | 34 ++--- make/config/jogl/gl-common.cfg | 32 +++-- make/config/jogl/glu-CustomJavaCode-base.java | 43 +++--- make/make.jogl.all.win32.bat | 2 +- .../com/sun/opengl/impl/GLDrawableImpl.java | 6 +- .../windows/wgl/WindowsExternalWGLContext.java | 7 +- .../windows/wgl/WindowsExternalWGLDrawable.java | 4 +- .../windows/wgl/WindowsPbufferWGLDrawable.java | 4 +- .../opengl/impl/windows/wgl/WindowsWGLContext.java | 5 + .../wgl/WindowsWGLGraphicsConfiguration.java | 149 +++++++++++++++++++-- .../WindowsWGLGraphicsConfigurationFactory.java | 112 ++++------------ .../com/sun/javafx/newt/windows/WindowsWindow.java | 7 +- 15 files changed, 306 insertions(+), 211 deletions(-) (limited to 'src/newt/classes/com/sun/javafx') diff --git a/etc/profile.jogl b/etc/profile.jogl index c1daef85d..24cac910f 100755 --- a/etc/profile.jogl +++ b/etc/profile.jogl @@ -30,25 +30,25 @@ JOGL_AWT="jogl.awt.jar jogl.util.awt.jar newt.awt.jar nativewindow.awt.jar" JOGL_CORE="nativewindow.core.jar nativewindow.x11.jar jogl.core.jar newt.core.jar newt.$OSS.jar newt.ogl.jar jogl.util.jar" -JOGL_JAR_ALL="$JOGL_CORE jogl.gles1.jar jogl.gles1.dbg.jar jogl.gles2.jar jogl.gles2.dbg.jar jogl.egl.jar jogl.gl2es12.$OSS.jar jogl.gl2es12.dbg.jar jogl.gl2.$OSS.jar jogl.gl2.dbg.jar jogl.util.gl2.jar jogl.glu.tess.jar jogl.glu.mipmap.jar jogl.glu.gl2.jar jogl.util.gl2.jar jogl.util.fixedfuncemu.jar $JOGL_AWT jogl.cg.jar" +JOGL_JAR_ALL="$JOGL_CORE jogl.gles1.jar jogl.gles1.dbg.jar jogl.gles2.jar jogl.gles2.dbg.jar jogl.egl.jar jogl.gl2es12.$OSS.jar jogl.gl2.$OSS.jar jogl.gl2.dbg.jar jogl.util.gl2.jar jogl.glu.tess.jar jogl.glu.mipmap.jar jogl.glu.gl2.jar jogl.util.gl2.jar jogl.util.fixedfuncemu.jar $JOGL_AWT jogl.cg.jar" JOGL_LIB_ALL="libjogl_gl2.so libjogl_es1.so libjogl_es2.so libnewt.so libjogl_awt.so" -JOGL_JAR_ES1_MIN="$JOGL_CORE jogl.gles1.jar jogl.egl.jar" +JOGL_JAR_ES1_MIN="$JOGL_CORE jogl.gles1.jar jogl.gles1.dbg.jar jogl.egl.jar" JOGL_JAR_ES1_MAX="$JOGL_CORE jogl.gles1.jar jogl.gles1.dbg.jar jogl.egl.jar jogl.glu.tess.jar jogl.glu.mipmap.jar $JOGL_AWT" JOGL_LIB_ES1_MIN="libjogl_es1.so libnewt.so" JOGL_LIB_ES1_MAX="libjogl_es1.so libnewt.so libjogl_awt.so libnativewindow_x11.so libnativewindow_awt.so" -JOGL_JAR_ES2_MIN="$JOGL_CORE jogl.gles2.jar jogl.egl.jar jogl.util.fixedfuncemu.jar" -JOGL_JAR_ES2_MAX="$JOGL_CORE jogl.gles2.jar jogl.egl.jar jogl.util.fixedfuncemu.jar jogl.glu.tess.jar $JOGL_AWT" +JOGL_JAR_ES2_MIN="$JOGL_CORE jogl.gles2.jar jogl.gles2.dbg.jar jogl.egl.jar jogl.util.fixedfuncemu.jar" +JOGL_JAR_ES2_MAX="$JOGL_CORE jogl.gles2.jar jogl.gles2.dbg.jar jogl.egl.jar jogl.util.fixedfuncemu.jar jogl.glu.tess.jar $JOGL_AWT" JOGL_LIB_ES2_MIN="libjogl_es2.so libnewt.so" JOGL_LIB_ES2_MAX="libjogl_es2.so libnewt.so libjogl_awt.so libnativewindow_x11.so libnativewindow_awt.so" -JOGL_JAR_GL2ES12_MIN="$JOGL_CORE jogl.gl2es12.$OSS.jar jogl.util.fixedfuncemu.jar" -JOGL_JAR_GL2ES12_MAX="$JOGL_CORE jogl.gl2es12.$OSS.jar jogl.util.fixedfuncemu.jar jogl.gl2es12.dbg.jar jogl.glu.tess.jar jogl.glu.mipmap.jar $JOGL_AWT" +JOGL_JAR_GL2ES12_MIN="$JOGL_CORE jogl.gl2es12.$OSS.jar jogl.gles1.dbg.jar jogl.gles2.dbg.jar jogl.util.fixedfuncemu.jar" +JOGL_JAR_GL2ES12_MAX="$JOGL_CORE jogl.gl2es12.$OSS.jar jogl.gles1.dbg.jar jogl.gles2.dbg.jar jogl.util.fixedfuncemu.jar jogl.gl2es12.dbg.jar jogl.glu.tess.jar jogl.glu.mipmap.jar $JOGL_AWT" JOGL_LIB_GL2ES12_MIN="libjogl_gl2es12.so libnewt.so libnativewindow_x11.so libnativewindow_awt.so" JOGL_LIB_GL2ES12_MAX="libjogl_gl2es12.so libnewt.so libnativewindow_x11.so libnativewindow_awt.so" -JOGL_JAR_GL2_MIN="$JOGL_CORE jogl.gl2.$OSS.jar" +JOGL_JAR_GL2_MIN="$JOGL_CORE jogl.gl2.$OSS.jar jogl.gl2.dbg.jar" JOGL_JAR_GL2_MAX="$JOGL_CORE jogl.gl2.$OSS.jar jogl.gl2.dbg.jar jogl.glu.tess.jar jogl.glu.mipmap.jar jogl.glu.gl2.jar jogl.util.gl2.jar $JOGL_AWT jogl.cg.jar" JOGL_LIB_GL2_MIN="libjogl_gl2.so libnewt.so libnativewindow_x11.so libnativewindow_awt.so" JOGL_LIB_GL2_MAX="libjogl_gl2.so libnewt.so libnativewindow_x11.so libnativewindow_awt.so" diff --git a/make/build-jogl.xml b/make/build-jogl.xml index 0f9a230a2..08f0d6ef2 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -1591,12 +1591,12 @@ - + - + @@ -1660,24 +1660,24 @@ - + - + - + - + @@ -1685,43 +1685,43 @@ - + - + - + - + - + - + - + - + @@ -1729,44 +1729,44 @@ - + - + - + - + - + - + - + - + @@ -1780,7 +1780,7 @@ - + @@ -1791,25 +1791,25 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -1849,29 +1849,29 @@ - + - + - + - + - + - + - + - + @@ -830,7 +830,7 @@ - + @@ -838,20 +838,20 @@ - + - + - + @@ -861,7 +861,7 @@ - + @@ -871,7 +871,7 @@ - + @@ -880,7 +880,7 @@ - + diff --git a/make/build-newt.xml b/make/build-newt.xml index acf78f09a..079d2e154 100644 --- a/make/build-newt.xml +++ b/make/build-newt.xml @@ -623,12 +623,12 @@ - + - + @@ -686,73 +686,73 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -760,7 +760,7 @@ - + @@ -768,7 +768,7 @@ - + diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg index 19e0eb8e4..a26c6a6b3 100644 --- a/make/config/jogl/gl-common.cfg +++ b/make/config/jogl/gl-common.cfg @@ -289,6 +289,14 @@ ReturnValueCapacity glXAllocateMemoryNV {0} # Pass arguments to ARB_vertex_program, ARB_fragment_program, # ARB_shader_objects, NV_vertex_program, NV_fragment_program, and # ARB_vertex_shader as Strings +ArgumentIsString glBindAttribLocation 2 +ArgumentIsString glBindAttribLocationARB 2 +ArgumentIsString glGetAttribLocation 1 +ArgumentIsString glGetAttribLocationARB 1 +ArgumentIsString glGetProgramNamedParameterfvNV 2 +ArgumentIsString glGetProgramNamedParameterdvNV 2 +ArgumentIsString glGetUniformLocation 1 +ArgumentIsString glGetUniformLocationARB 1 ArgumentIsString glLoadProgramNV 3 ArgumentIsString glProgramString 3 ArgumentIsString glProgramStringARB 3 @@ -296,16 +304,24 @@ ArgumentIsString glProgramNamedParameter4fNV 2 ArgumentIsString glProgramNamedParameter4dNV 2 ArgumentIsString glProgramNamedParameter4fvNV 2 ArgumentIsString glProgramNamedParameter4dvNV 2 -ArgumentIsString glGetProgramNamedParameterfvNV 2 -ArgumentIsString glGetProgramNamedParameterdvNV 2 ArgumentIsString glShaderSource 2 ArgumentIsString glShaderSourceARB 2 -ArgumentIsString glGetUniformLocation 1 -ArgumentIsString glGetUniformLocationARB 1 -ArgumentIsString glBindAttribLocation 2 -ArgumentIsString glBindAttribLocationARB 2 -ArgumentIsString glGetAttribLocation 1 -ArgumentIsString glGetAttribLocationARB 1 + +ArgumentIsString glBindFragDataLocation 2 +ArgumentIsString glGetFragDataLocation 1 +ArgumentIsString glGetUniformIndices 2 +ArgumentIsString glGetUniformBlockIndex 1 +ArgumentIsString glTransformFeedbackVaryings 2 + +# String output values: +# ArgumentIsString glGetActiveAttrib 6 +# ArgumentIsString glGetActiveUniformBlockName 4 +# ArgumentIsString glGetActiveUniformName 4 +# ArgumentIsString glGetActiveUniform 6 +# ArgumentIsString glGetProgramInfoLog 3 +# ArgumentIsString glGetShaderInfoLog 3 +# ArgumentIsString glGetShaderSource 3 +# ArgumentIsString glGetTransformFeedbackVarying 6 # # Directives for Vertex Buffer Object and Pixel Buffer Object checking diff --git a/make/config/jogl/glu-CustomJavaCode-base.java b/make/config/jogl/glu-CustomJavaCode-base.java index 6949cfb68..78c067606 100755 --- a/make/config/jogl/glu-CustomJavaCode-base.java +++ b/make/config/jogl/glu-CustomJavaCode-base.java @@ -76,8 +76,19 @@ public boolean isFunctionAvailable(String gluFunctionName) // Utility routines // -private static Class gl2Class; -private static Class gl2es1Class; +private static final Class gl2Class; +private static final Class gl2es1Class; + +static { + Class _gl2Class=null; + Class _gl2es1Class=null; + try { + _gl2Class = Class.forName("javax.media.opengl.glu.gl2.GLUgl2"); + _gl2es1Class = Class.forName("javax.media.opengl.glu.gl2es1.GLUgl2es1"); + } catch (Throwable t) {} + gl2Class = _gl2Class; + gl2es1Class = _gl2es1Class; +} /** * Instantiates a GLU implementation object in respect to the given GL profile @@ -94,32 +105,20 @@ public static final GLU createGLU() throws GLException { public static final GLU createGLU(GL gl) throws GLException { try { Class c = null; - if(gl.isGL2()) { - if (gl2Class == null) { - gl2Class = Class.forName("javax.media.opengl.glu.gl2.GLUgl2"); - } + if(gl.isGL2() && null!=gl2Class) { c = gl2Class; - } else if (gl.isGL2ES1()) { - if (gl2es1Class == null) { - gl2es1Class = Class.forName("javax.media.opengl.glu.gl2es1.GLUgl2es1"); - } + } else if(gl.isGL2ES1() && null!=gl2es1Class) { c = gl2es1Class; + /** There is no specialized ES 2 GLU at this time + } else if(gl.isGL2ES2() && null!=gl2es2Class) { + c = gl2es2Class; */ + } else { + c = GLU.class; } - if (c != null) { - return (GLU) c.newInstance(); - } + return (GLU) c.newInstance(); } catch (Exception e) { throw new GLException(e); } - // There is no specialized ES 2 GLU at this time - /* - try { - if(GLProfile.GL2ES12.equals(profile) || GLProfile.GL2.equals(profile) || GLProfile.GLES2.equals(profile)) { - return (GLU) NWReflection.createInstance("javax.media.opengl.glu.gl2es2.GLUgl2es2"); - } - } catch (GLException e) { e.printStackTrace(); } - */ - return new GLU(); } public GLU() diff --git a/make/make.jogl.all.win32.bat b/make/make.jogl.all.win32.bat index f4a52fa75..9ab77b051 100644 --- a/make/make.jogl.all.win32.bat +++ b/make/make.jogl.all.win32.bat @@ -9,4 +9,4 @@ REM -DuseOpenMAX=true REM -DuseKD=true REM -Djogl.cg=1 -D-Dwindows.cg.lib=C:\Cg-2.2 -ant -Drootrel.build=build-win32 -Djogl.cg=1 -Dwindows.cg.lib=C:\Cg-2.2\lib > make.jogl.all.win32.log 2>&1 +ant -Dbuild.noarchives=true -Dc.compiler.debug=true -Drootrel.build=build-win32 -Djogl.cg=1 -Dwindows.cg.lib=C:\Cg-2.2\lib > make.jogl.all.win32.log 2>&1 diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java index 15ccc0f96..81fc0b78b 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java @@ -140,10 +140,10 @@ public abstract class GLDrawableImpl implements GLDrawable { public String toString() { return getClass().getName()+"[realized "+getRealized()+ - ",\n\trequested "+getRequestedGLCapabilities()+ - ",\n\tchosen "+getChosenGLCapabilities()+ + ",\n\tfactory "+getFactory()+ ",\n\twindow "+getNativeWindow()+ - ",\n\tfactory "+getFactory()+"]"; + ",\n\trequested "+getRequestedGLCapabilities()+ + ",\n\tchosen "+getChosenGLCapabilities()+"]"; } protected GLDrawableFactory factory; diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLContext.java index b9fc80156..31e65fc8c 100755 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLContext.java @@ -51,7 +51,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { private boolean created = true; private GLContext lastContext; - private WindowsExternalWGLContext(Drawable drawable, long hglrc) { + private WindowsExternalWGLContext(Drawable drawable, long hglrc, WindowsWGLGraphicsConfiguration cfg) { super(drawable, null); this.hglrc = hglrc; if (DEBUG) { @@ -59,6 +59,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { } GLContextShareSet.contextCreated(this); setGLFunctionAvailability(false); + cfg.updateCapabilitiesByWGL(this); } protected static WindowsExternalWGLContext create(GLDrawableFactory factory, GLProfile glp) { @@ -76,12 +77,12 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { } AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(); - WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.create(glp, aScreen, hdc, pfdID, true, true); + WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.create(hdc, pfdID, glp, aScreen, true, true); NullWindow nw = new NullWindow(cfg); nw.setSurfaceHandle(hdc); - return new WindowsExternalWGLContext(new Drawable(factory, nw), hglrc); + return new WindowsExternalWGLContext(new Drawable(factory, nw), hglrc, cfg); } public int makeCurrent() throws GLException { diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java index 706675893..9b87afc38 100755 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java @@ -61,12 +61,12 @@ public class WindowsExternalWGLDrawable extends WindowsWGLDrawable { } AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(); - WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.create(glp, aScreen, hdc, pfdID, true, true); + WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.create(hdc, pfdID, glp, aScreen, true, true); NullWindow nw = new NullWindow(cfg); nw.setSurfaceHandle(hdc); - // cfg.updateGraphicsConfiguration(factory, nw); + cfg.updateGraphicsConfiguration(factory, nw); return new WindowsExternalWGLDrawable(factory, nw); } 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 f54e8f1a0..79dda9049 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 @@ -295,7 +295,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { if(newCaps.isOnscreen()) { throw new GLException("Error: Selected Onscreen Caps for PBuffer: "+newCaps); } - config.setCapsPFD(newCaps, pfd, pformats[whichFormat]); + config.setCapsPFD(newCaps, pfd, pformats[whichFormat], true); } else { PIXELFORMATDESCRIPTOR pfd = WindowsWGLGraphicsConfiguration.createPixelFormatDescriptor(); if (WGL.DescribePixelFormat(parentHdc, pformats[whichFormat], pfd.size(), pfd) == 0) { @@ -305,7 +305,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { if(newCaps.isOnscreen()) { throw new GLException("Error: Selected Onscreen Caps for PBuffer: "+newCaps); } - config.setCapsPFD(newCaps, pfd, pformats[whichFormat]); + config.setCapsPFD(newCaps, pfd, pformats[whichFormat], false); } } diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java index 92a563445..578279586 100644 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java @@ -264,6 +264,11 @@ public class WindowsWGLContext extends GLContextImpl { if (created) { setGLFunctionAvailability(false); + + WindowsWGLGraphicsConfiguration config = + (WindowsWGLGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + config.updateCapabilitiesByWGL(this); + return CONTEXT_CURRENT_NEW; } return CONTEXT_CURRENT; diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java index 1a8d45465..844e72841 100644 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -49,6 +49,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio private int pixelfmtID; private boolean isChosen = false; private GLCapabilitiesChooser chooser; + private boolean choosenByWGLPixelFormat=false; public WindowsWGLGraphicsConfiguration(AbstractGraphicsScreen screen, GLCapabilities capsChosen, GLCapabilities capsRequested, PIXELFORMATDESCRIPTOR pixelfmt, int pixelfmtID, GLCapabilitiesChooser chooser) { @@ -58,17 +59,26 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio this.pixelfmtID = pixelfmtID; } - public static WindowsWGLGraphicsConfiguration create(GLProfile glp, AbstractGraphicsScreen screen, long hdc, int pfdID, boolean onscreen, boolean usePBuffer) { - PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(); - if (WGL.DescribePixelFormat(hdc, pfdID, pfd.size(), pfd) == 0) { - throw new GLException("Unable to describe pixel format " + pfdID); + public static WindowsWGLGraphicsConfiguration create(long hdc, int pfdID, + GLProfile glp, AbstractGraphicsScreen screen, boolean onscreen, boolean usePBuffer) + { + if(pfdID<=0) { + throw new GLException("Invalid pixelformat id "+pfdID); } if(null==glp) { glp = GLProfile.getDefault(); } + PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(); + if (WGL.DescribePixelFormat(hdc, pfdID, pfd.size(), pfd) == 0) { + throw new GLException("Unable to describe pixel format " + pfdID); + } + GLCapabilities caps = PFD2GLCapabilities(glp, pfd, onscreen, usePBuffer); + if(null==caps) { + throw new GLException("Couldn't choose Capabilities by: HDC 0x"+Long.toHexString(hdc)+", pfdID "+pfdID); + } WindowsWGLGraphicsConfiguration cfg = new WindowsWGLGraphicsConfiguration(screen, caps, caps, pfd, pfdID, new DefaultGLCapabilitiesChooser()); - cfg.setCapsPFD(caps, pfd, pfdID); + cfg.setCapsPFD(caps, pfd, pfdID, false); return cfg; } @@ -77,15 +87,40 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio return super.clone(); } + /** Update config - before having a valid context */ protected void updateGraphicsConfiguration(GLDrawableFactory factory, NativeWindow nativeWindow) { WindowsWGLGraphicsConfigurationFactory.updateGraphicsConfiguration(chooser, factory, nativeWindow); } - protected void setCapsPFD(GLCapabilities caps, PIXELFORMATDESCRIPTOR pfd, int pfdID) { - // FIXME: setScreen ( .. ) + + /** Update config - after having a valid and current context */ + protected void updateCapabilitiesByWGL(GLContextImpl context) { + if(choosenByWGLPixelFormat) return; // already done .. + + GLCapabilities capabilities = (GLCapabilities) getRequestedCapabilities(); + boolean onscreen = capabilities.isOnscreen(); + boolean usePBuffer = capabilities.isPBuffer(); + GLProfile glp = capabilities.getGLProfile(); + + WGLExt wglExt = (WGLExt) context.getPlatformGLExtensions(); + GLDrawable drawable = context.getGLDrawable(); + NativeWindow nativeWindow = drawable.getNativeWindow(); + long hdc = nativeWindow.getSurfaceHandle(); + + GLCapabilities[] caps = HDC2GLCapabilities(wglExt, hdc, getPixelFormatID(), glp, true, onscreen, usePBuffer); + if(null!=caps && null!=caps[0]) { + setCapsPFD(caps[0], getPixelFormat(), getPixelFormatID(), true); + } + } + + protected void setCapsPFD(GLCapabilities caps, PIXELFORMATDESCRIPTOR pfd, int pfdID, boolean choosenByWGLPixelFormat) { this.pixelfmt = pfd; this.pixelfmtID = pfdID; setChosenCapabilities(caps); - isChosen=true; + this.isChosen=true; + this.choosenByWGLPixelFormat=choosenByWGLPixelFormat; + if (DEBUG) { + System.err.println("*** setCapsPFD: WGL-Choosen "+choosenByWGLPixelFormat+", pfdID "+pfdID+", "+caps); + } } public boolean getCapabilitiesChosen() { @@ -94,6 +129,102 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio public PIXELFORMATDESCRIPTOR getPixelFormat() { return pixelfmt; } public int getPixelFormatID() { return pixelfmtID; } + public boolean isChoosenByWGL() { return choosenByWGLPixelFormat; } + + private static int haveWGLChoosePixelFormatARB = -1; + private static int haveWGLARBMultisample = -1; + + public static GLCapabilities[] HDC2GLCapabilities(WGLExt wglExt, long hdc, int pfdIDOnly, + GLProfile glp, boolean relaxed, boolean onscreen, boolean usePBuffer) { + + if(haveWGLChoosePixelFormatARB<0) { + haveWGLChoosePixelFormatARB = wglExt.isExtensionAvailable("WGL_ARB_pixel_format")?1:0; + } + if(haveWGLARBMultisample<0) { + haveWGLARBMultisample = wglExt.isExtensionAvailable("WGL_ARB_multisample")?1:0; + } + if (0==haveWGLChoosePixelFormatARB) { + return null; + } + + // Produce a list of GLCapabilities to give to the + // GLCapabilitiesChooser. + // Use wglGetPixelFormatAttribivARB instead of + // DescribePixelFormat to get higher-precision information + // about the pixel format (should make the GLCapabilities + // more precise as well...i.e., remove the + // "HardwareAccelerated" bit, which is basically + // meaningless, and put in whether it can render to a + // window, to a pbuffer, or to a pixmap) + GLCapabilities[] availableCaps = null; + int numFormats = 0; + int niattribs = 0; + int[] iattributes = new int [2*MAX_ATTRIBS]; + int[] iresults = new int [2*MAX_ATTRIBS]; + + iattributes[0] = WGLExt.WGL_NUMBER_PIXEL_FORMATS_ARB; + if (wglExt.wglGetPixelFormatAttribivARB(hdc, 0, 0, 1, iattributes, 0, iresults, 0)) { + numFormats = iresults[0]; + + if (DEBUG) { + System.err.println("wglGetPixelFormatAttribivARB reported WGL_NUMBER_PIXEL_FORMATS = " + numFormats); + } + + if(pfdIDOnly>0 && pfdIDOnly>numFormats) { + throw new GLException("Invalid pixelformat ID " + pfdIDOnly + " (should be between 1 and " + numFormats + ")"); + } + + // Should we be filtering out the pixel formats which aren't + // applicable, as we are doing here? + // We don't have enough information in the GLCapabilities to + // represent those that aren't... + iattributes[niattribs++] = WGLExt.WGL_DRAW_TO_WINDOW_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCELERATION_ARB; + iattributes[niattribs++] = WGLExt.WGL_SUPPORT_OPENGL_ARB; + iattributes[niattribs++] = WGLExt.WGL_DEPTH_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_STENCIL_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_DOUBLE_BUFFER_ARB; + iattributes[niattribs++] = WGLExt.WGL_STEREO_ARB; + iattributes[niattribs++] = WGLExt.WGL_PIXEL_TYPE_ARB; + iattributes[niattribs++] = WGLExt.WGL_RED_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_GREEN_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_BLUE_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ALPHA_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCUM_RED_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCUM_GREEN_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCUM_BLUE_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCUM_ALPHA_BITS_ARB; + if (1==haveWGLARBMultisample) { + iattributes[niattribs++] = WGLExt.WGL_SAMPLE_BUFFERS_ARB; + iattributes[niattribs++] = WGLExt.WGL_SAMPLES_ARB; + } + + if(pfdIDOnly>0) { + availableCaps = new GLCapabilities[1]; + if (!wglExt.wglGetPixelFormatAttribivARB(hdc, pfdIDOnly, 0, niattribs, iattributes, 0, iresults, 0)) { + throw new GLException("Error getting pixel format attributes for pixel format " + pfdIDOnly + " of device context"); + } + availableCaps[0] = AttribList2GLCapabilities(glp, iattributes, niattribs, iresults, + relaxed, onscreen, usePBuffer); + } else { + availableCaps = new GLCapabilities[numFormats]; + for (int i = 0; i < numFormats; i++) { + if (!wglExt.wglGetPixelFormatAttribivARB(hdc, i+1, 0, niattribs, iattributes, 0, iresults, 0)) { + throw new GLException("Error getting pixel format attributes for pixel format " + (i + 1) + " of device context"); + } + availableCaps[i] = AttribList2GLCapabilities(glp, iattributes, niattribs, iresults, + relaxed, onscreen, usePBuffer); + } + } + } else { + long lastErr = WGL.GetLastError(); + // Intel Extreme graphics fails with a zero error code + if (lastErr != 0) { + throw new GLException("Unable to enumerate pixel formats of window using wglGetPixelFormatAttribivARB: error code " + WGL.GetLastError()); + } + } + return availableCaps; + } public static boolean GLCapabilities2AttribList(GLCapabilities caps, int[] iattributes, @@ -498,7 +629,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio } public String toString() { - return "WindowsWGLGraphicsConfiguration["+getScreen()+", pfdID " + pixelfmtID + + return "WindowsWGLGraphicsConfiguration["+getScreen()+", pfdID " + pixelfmtID + ", wglChoosen "+choosenByWGLPixelFormat+ ",\n\trequested " + getRequestedCapabilities() + ",\n\tchosen " + getChosenCapabilities() + "]"; diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java index f5974dc61..98ad83313 100644 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java @@ -99,6 +99,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects"); } + boolean choosenBywGLPixelFormat = false; WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) nativeWindow.getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilities capabilities = (GLCapabilities) config.getRequestedCapabilities(); boolean onscreen = capabilities.isOnscreen(); @@ -113,7 +114,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio } PIXELFORMATDESCRIPTOR pfd = null; - int pixelFormat = -1; + int pixelFormat = -1; // 1-based pixel format boolean pixelFormatSet = false; GLCapabilities chosenCaps = null; @@ -125,7 +126,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio // - or the Java2D/OpenGL pipeline's configuration if (DEBUG) { System.err.println("!!!! NOTE: pixel format already chosen for HDC: 0x" + Long.toHexString(hdc)+ - ", pixelformat "+WGL.GetPixelFormat(hdc)); + ", pixelformat "+pixelFormat); } pixelFormatSet = true; } @@ -138,27 +139,25 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio WindowsWGLDrawable dummyDrawable = null; GLContextImpl dummyContext = null; WGLExt dummyWGLExt = null; - dummyDrawable = new WindowsDummyWGLDrawable(factory); - dummyContext = (GLContextImpl) dummyDrawable.createContext(null); - if (dummyContext != null) { - dummyContext.makeCurrent(); - dummyWGLExt = (WGLExt) dummyContext.getPlatformGLExtensions(); - } - int recommendedPixelFormat = pixelFormat - 1; + if (capabilities.getSampleBuffers()) { + dummyDrawable = new WindowsDummyWGLDrawable(factory); + dummyContext = (GLContextImpl) dummyDrawable.createContext(null); + if (dummyContext != null) { + dummyContext.makeCurrent(); + dummyWGLExt = (WGLExt) dummyContext.getPlatformGLExtensions(); + } + } + int recommendedPixelFormat = pixelFormat; // 1-based pixel format boolean haveWGLChoosePixelFormatARB = false; - boolean haveWGLARBMultisample = false; boolean gotAvailableCaps = false; if (dummyWGLExt != null) { try { haveWGLChoosePixelFormatARB = dummyWGLExt.isExtensionAvailable("WGL_ARB_pixel_format"); if (haveWGLChoosePixelFormatARB) { - haveWGLARBMultisample = dummyWGLExt.isExtensionAvailable("WGL_ARB_multisample"); - - int[] iattributes = new int [2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS]; - int[] iresults = new int [2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS]; - float[] fattributes = new float[1]; - if(pixelFormat<=0) { + int[] iattributes = new int [2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS]; + float[] fattributes = new float[1]; + if(WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(capabilities, iattributes, dummyWGLExt, @@ -174,8 +173,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio numFormatsTmp, 0)) { numFormats = numFormatsTmp[0]; if (recommendedPixelFormat<=0 && numFormats > 0) { - // Remove one-basing of pixel format (added on later) - recommendedPixelFormat = pformats[0] - 1; + recommendedPixelFormat = pformats[0]; if (DEBUG) { System.err.println(getThreadName() + ": Used wglChoosePixelFormatARB to recommend pixel format " + recommendedPixelFormat); } @@ -187,7 +185,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio } } if (DEBUG) { - if (recommendedPixelFormat < 0) { + if (recommendedPixelFormat <= 0) { System.err.print(getThreadName() + ": wglChoosePixelFormatARB didn't recommend a pixel format"); if (capabilities.getSampleBuffers()) { System.err.print(" for multisampled GLCapabilities"); @@ -198,65 +196,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio } } - // Produce a list of GLCapabilities to give to the - // GLCapabilitiesChooser. - // Use wglGetPixelFormatAttribivARB instead of - // DescribePixelFormat to get higher-precision information - // about the pixel format (should make the GLCapabilities - // more precise as well...i.e., remove the - // "HardwareAccelerated" bit, which is basically - // meaningless, and put in whether it can render to a - // window, to a pbuffer, or to a pixmap) - int niattribs = 0; - iattributes[0] = WGLExt.WGL_NUMBER_PIXEL_FORMATS_ARB; - if (dummyWGLExt.wglGetPixelFormatAttribivARB(hdc, 0, 0, 1, iattributes, 0, iresults, 0)) { - numFormats = iresults[0]; - - if (DEBUG) { - System.err.println("wglGetPixelFormatAttribivARB reported WGL_NUMBER_PIXEL_FORMATS = " + numFormats); - } - - // Should we be filtering out the pixel formats which aren't - // applicable, as we are doing here? - // We don't have enough information in the GLCapabilities to - // represent those that aren't... - iattributes[niattribs++] = WGLExt.WGL_DRAW_TO_WINDOW_ARB; - iattributes[niattribs++] = WGLExt.WGL_ACCELERATION_ARB; - iattributes[niattribs++] = WGLExt.WGL_SUPPORT_OPENGL_ARB; - iattributes[niattribs++] = WGLExt.WGL_DEPTH_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_STENCIL_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_DOUBLE_BUFFER_ARB; - iattributes[niattribs++] = WGLExt.WGL_STEREO_ARB; - iattributes[niattribs++] = WGLExt.WGL_PIXEL_TYPE_ARB; - iattributes[niattribs++] = WGLExt.WGL_RED_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_GREEN_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_BLUE_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_ALPHA_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_ACCUM_RED_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_ACCUM_GREEN_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_ACCUM_BLUE_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_ACCUM_ALPHA_BITS_ARB; - if (haveWGLARBMultisample) { - iattributes[niattribs++] = WGLExt.WGL_SAMPLE_BUFFERS_ARB; - iattributes[niattribs++] = WGLExt.WGL_SAMPLES_ARB; - } - - availableCaps = new GLCapabilities[numFormats]; - for (int i = 0; i < numFormats; i++) { - if (!dummyWGLExt.wglGetPixelFormatAttribivARB(hdc, i+1, 0, niattribs, iattributes, 0, iresults, 0)) { - throw new GLException("Error getting pixel format attributes for pixel format " + (i + 1) + " of device context"); - } - availableCaps[i] = WindowsWGLGraphicsConfiguration.AttribList2GLCapabilities(glProfile, iattributes, niattribs, iresults, - pixelFormatSet, onscreen, usePBuffer); - } - gotAvailableCaps = true; - } else { - long lastErr = WGL.GetLastError(); - // Intel Extreme graphics fails with a zero error code - if (lastErr != 0) { - throw new GLException("Unable to enumerate pixel formats of window using wglGetPixelFormatAttribivARB: error code " + WGL.GetLastError()); - } - } + availableCaps = WindowsWGLGraphicsConfiguration.HDC2GLCapabilities(dummyWGLExt, hdc, -1, glProfile, pixelFormatSet, onscreen, usePBuffer); + gotAvailableCaps = null!=availableCaps ; + choosenBywGLPixelFormat = gotAvailableCaps ; } } finally { dummyContext.release(); @@ -265,7 +207,6 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio } } - // Fallback path for older cards, in particular Intel Extreme motherboard graphics if (!gotAvailableCaps) { if (DEBUG) { if (!capabilities.getSampleBuffers()) { @@ -279,8 +220,6 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio if (DEBUG) { System.err.println(getThreadName() + ": Recommended pixel format = " + recommendedPixelFormat); } - // Remove one-basing of pixel format (added on later) - recommendedPixelFormat -= 1; numFormats = WGL.DescribePixelFormat(hdc, 1, 0, null); if (numFormats == 0) { @@ -305,19 +244,18 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio if(null!=chooser) { // Supply information to chooser try { - pixelFormat = chooser.chooseCapabilities(capabilities, availableCaps, recommendedPixelFormat); + pixelFormat = chooser.chooseCapabilities(capabilities, availableCaps, recommendedPixelFormat) + 1; } catch (NativeWindowException e) { throw new GLException(e); } } else { pixelFormat = recommendedPixelFormat; } - if ((pixelFormat < 0) || (pixelFormat >= numFormats)) { + if ((pixelFormat <= 0) || (pixelFormat > numFormats)) { throw new GLException("Invalid result " + pixelFormat + - " from GLCapabilitiesChooser (should be between 0 and " + - (numFormats - 1) + ")"); + " from GLCapabilitiesChooser (should be between 1 and " + + numFormats + ")"); } - pixelFormat += 1; // one-base the index } chosenCaps = availableCaps[pixelFormat-1]; if (DEBUG) { @@ -355,7 +293,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio } else { capabilities = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(glProfile, pfd, onscreen, usePBuffer); } - config.setCapsPFD(capabilities, pfd, pixelFormat); + config.setCapsPFD(capabilities, pfd, pixelFormat, choosenBywGLPixelFormat); } protected static String getThreadName() { diff --git a/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java b/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java index a173baff0..18dc7dae3 100755 --- a/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java +++ b/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java @@ -59,7 +59,7 @@ public class WindowsWindow extends Window { hmon = MonitorFromWindow(windowHandle); if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { Exception e = new Exception("!!! Window new surface handle "+Thread.currentThread().getName()+ - ",HDC 0x"+Long.toHexString(hdc)+", HMON 0x"+Long.toHexString(hmon)); + ", HWND 0x"+Long.toHexString(windowHandle)+", HDC 0x"+Long.toHexString(hdc)+", HMON 0x"+Long.toHexString(hmon)); e.printStackTrace(); } } @@ -105,6 +105,11 @@ public class WindowsWindow extends Window { throw new NativeWindowException("Error creating window"); } windowHandleClose = windowHandle; + if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { + Exception e = new Exception("!!! Window new window handle "+Thread.currentThread().getName()+ + ", HWND 0x"+Long.toHexString(windowHandle)); + e.printStackTrace(); + } } protected void closeNative() { -- cgit v1.2.3 From 4e0a5af0b359b98b26ea3e961d023c658650be6c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 1 Aug 2009 05:37:29 -0700 Subject: GL3 Related: - Fix glGetStringi's return type to String - Fix ExtensionAvailabilityCache: GL3's glGetStringi for GL_EXTENSIONS Ensure to add GL_VERSION_2_0 in case version >= 3.0 Ensure to not exceed version 3.0 for non GL3.1 context. In case of GL 3.1, do not include GL_VERSIONS below 3.0, since this is a forward compatible context. - Add Prologue to glGetString, where the ExtensionCache is being used for GL_EXTENSIONS - if already initialized. This feature adds backward compatibility for GL3 context on GL_EXTENSION. +++ General: Add GLPipelineFactory, a convenient pipeline factory for Debug/Trace and custom ones .. Change 'void setGL(GL)' to 'GL setGL(GL)', and let it return the successful set GL, or null. --- make/config/jogl/gl-common.cfg | 9 + make/config/jogl/gl-gl2es12.cfg | 2 +- .../opengl/impl/ExtensionAvailabilityCache.java | 178 +++++++++++++++---- .../classes/com/sun/opengl/impl/GLContextImpl.java | 26 ++- .../classes/com/sun/opengl/impl/GLPbufferImpl.java | 4 +- .../opengl/util/glsl/fixedfunc/FixedFuncUtil.java | 15 +- .../classes/javax/media/opengl/GLAutoDrawable.java | 5 +- src/jogl/classes/javax/media/opengl/GLContext.java | 4 +- .../javax/media/opengl/GLPipelineFactory.java | 195 +++++++++++++++++++++ .../classes/javax/media/opengl/awt/GLCanvas.java | 4 +- .../classes/javax/media/opengl/awt/GLJPanel.java | 4 +- .../com/sun/javafx/newt/opengl/GLWindow.java | 4 +- 12 files changed, 405 insertions(+), 45 deletions(-) create mode 100644 src/jogl/classes/javax/media/opengl/GLPipelineFactory.java (limited to 'src/newt/classes/com/sun/javafx') diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg index a26c6a6b3..269ea68a7 100644 --- a/make/config/jogl/gl-common.cfg +++ b/make/config/jogl/gl-common.cfg @@ -230,6 +230,7 @@ IgnoreExtension GL_EXT_texture_rectangle Opaque boolean GLboolean ReturnsString glGetString +ReturnsString glGetStringi # Experimental: Only NIO function, no arrays .. # NIOOnly __ALL__ @@ -323,6 +324,14 @@ ArgumentIsString glTransformFeedbackVaryings 2 # ArgumentIsString glGetShaderSource 3 # ArgumentIsString glGetTransformFeedbackVarying 6 +# +# Use cached GL_EXTENSION if possible, +# which also allows GL3 compatibility. +# +JavaPrologue glGetString if(GL.GL_EXTENSIONS==name && _context.isExtensionCacheInitialized()) { +JavaPrologue glGetString return _context.getGLExtensions(); +JavaPrologue glGetString } + # # Directives for Vertex Buffer Object and Pixel Buffer Object checking # diff --git a/make/config/jogl/gl-gl2es12.cfg b/make/config/jogl/gl-gl2es12.cfg index 27fa138d4..36bab82ed 100644 --- a/make/config/jogl/gl-gl2es12.cfg +++ b/make/config/jogl/gl-gl2es12.cfg @@ -13,10 +13,10 @@ ExtendedInterfaceSymbolsOnly ../src/jogl/classes/javax/media/opengl/fixedfunc/GL Style ImplOnly ImplPackage com.sun.opengl.impl.gl2es12 ImplJavaClass GL2ES12Impl +Implements GL2ES12Impl GLBase Implements GL2ES12Impl GL Implements GL2ES12Impl GL2ES1 Implements GL2ES12Impl GL2ES2 -Implements GL2ES12Impl GLBase Include gl-common-gl2.cfg Include gl-common-extensions.cfg diff --git a/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java b/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java index eee308088..7931f791b 100644 --- a/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java +++ b/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java @@ -65,7 +65,25 @@ public final class ExtensionAvailabilityCache { */ public void flush() { + if(DEBUG) { + System.out.println("ExtensionAvailabilityCache: Flush availability OpenGL "+majorVersion+"."+minorVersion); + } availableExtensionCache.clear(); + initialized = false; + majorVersion = 1; + minorVersion = 0; + } + + /** + * Flush the cache and rebuild the cache. + */ + public void reset() { + flush(); + initAvailableExtensions(); + } + + public boolean isInitialized() { + return initialized && !availableExtensionCache.isEmpty() ; } public boolean isExtensionAvailable(String glExtensionName) { @@ -73,19 +91,101 @@ public final class ExtensionAvailabilityCache { return availableExtensionCache.contains(mapGLExtensionName(glExtensionName)); } - protected void initAvailableExtensions() { + public String getPlatformExtensionsString() { + initAvailableExtensions(); + return glXExtensions; + } + + public String getGLExtensions() { + initAvailableExtensions(); + if(DEBUG) { + System.err.println("ExtensionAvailabilityCache: getGLExtensions() called"); + } + return glExtensions; + } + + public int getMajorVersion() { + initAvailableExtensions(); + return majorVersion; + } + + public int getMinorVersion() { + initAvailableExtensions(); + return minorVersion; + } + + private void initAvailableExtensions() { // if hash is empty (meaning it was flushed), pre-cache it with the list // of extensions that are in the GL_EXTENSIONS string - if (availableExtensionCache.isEmpty()) { + if (availableExtensionCache.isEmpty() || !initialized) { GL gl = context.getGL(); + if (DEBUG) { - System.err.println("!!! Pre-caching extension availability"); + System.err.println("ExtensionAvailabilityCache: Pre-caching init "+gl+", GL_VERSION "+gl.glGetString(GL.GL_VERSION)); + } + + // Set version + Version version = new Version(gl.glGetString(GL.GL_VERSION)); + if (version.isValid()) { + majorVersion = version.getMajor(); + minorVersion = version.getMinor(); + + if( !gl.isGL3() && + ( majorVersion > 3 || + ( majorVersion == 3 && minorVersion >= 1 ) ) ) { + // downsize version to 3.0 in case we are not using GL3 (3.1) + majorVersion = 3; + minorVersion = 0; + } } - String allAvailableExtensions = - gl.glGetString(GL.GL_EXTENSIONS) + " " + context.getPlatformExtensionsString(); + + boolean useGetStringi = false; + + if ( majorVersion > 3 || + ( majorVersion == 3 && minorVersion >= 0 ) || + gl.isGL3() ) { + if ( ! gl.isGL2GL3() ) { + if(DEBUG) { + System.err.println("ExtensionAvailabilityCache: GL >= 3.1 usage, but no GL2GL3 interface: "+gl.getClass().getName()); + } + } else if ( ! gl.isFunctionAvailable("glGetStringi") ) { + if(DEBUG) { + System.err.println("ExtensionAvailabilityCache: GL >= 3.1 usage, but no glGetStringi"); + } + } else { + useGetStringi = true; + } + } + if (DEBUG) { - System.err.println("!!! Available extensions: " + allAvailableExtensions); - System.err.println("!!! GL vendor: " + gl.glGetString(GL.GL_VENDOR)); + System.err.println("ExtensionAvailabilityCache: Pre-caching extension availability OpenGL "+majorVersion+"."+minorVersion+ + ", use "+ ( useGetStringi ? "glGetStringi" : "glGetString" ) ); + } + + StringBuffer sb = new StringBuffer(); + if(useGetStringi) { + GL2GL3 gl2gl3 = gl.getGL2GL3(); + int[] numExtensions = { 0 } ; + gl2gl3.glGetIntegerv(gl2gl3.GL_NUM_EXTENSIONS, numExtensions, 0); + for (int i = 0; i < numExtensions[0]; i++) { + sb.append(gl2gl3.glGetStringi(gl2gl3.GL_EXTENSIONS, i)); + if(i < numExtensions[0]) { + sb.append(" "); + } + } + } else { + sb.append(gl.glGetString(GL.GL_EXTENSIONS)); + } + glExtensions = sb.toString(); + glXExtensions = context.getPlatformExtensionsString(); + + sb.append(" "); + sb.append(glXExtensions); + + String allAvailableExtensions = sb.toString(); + if (DEBUG_AVAILABILITY) { + System.err.println("ExtensionAvailabilityCache: Available extensions: " + allAvailableExtensions); + System.err.println("ExtensionAvailabilityCache: GL vendor: " + gl.glGetString(GL.GL_VENDOR)); } StringTokenizer tok = new StringTokenizer(allAvailableExtensions); while (tok.hasMoreTokens()) { @@ -93,42 +193,53 @@ public final class ExtensionAvailabilityCache { availableExt = availableExt.intern(); availableExtensionCache.add(availableExt); if (DEBUG_AVAILABILITY) { - System.err.println("!!! Available: " + availableExt); + System.err.println("ExtensionAvailabilityCache: Available: " + availableExt); } } // Put GL version strings in the table as well - Version version = new Version(gl.glGetString(GL.GL_VERSION)); - if (version.isValid()) { - int major = version.getMajor(); - int minor = version.getMinor(); - // FIXME: this needs to be adjusted when the major rev changes - // beyond the known ones - while (major > 0) { - while (minor >= 0) { - availableExtensionCache.add("GL_VERSION_" + major + "_" + minor); - if (DEBUG) { - System.err.println("!!! Added GL_VERSION_" + major + "_" + minor + " to known extensions"); - } - --minor; + // FIXME: this needs to be adjusted when the major rev changes + // beyond the known ones + int major = majorVersion; + int minor = minorVersion; + while (major > 0) { + while (minor >= 0) { + availableExtensionCache.add("GL_VERSION_" + major + "_" + minor); + if (DEBUG) { + System.err.println("ExtensionAvailabilityCache: Added GL_VERSION_" + major + "_" + minor + " to known extensions"); } + --minor; + } - switch (major) { - case 2: - // Restart loop at version 1.5 - minor = 5; - break; - case 1: - break; + switch (major) { + case 2: + if(gl.isGL3() && major==2) { + // GL3 is a GL 3.1 forward compatible context, + // hence no 2.0, 1.0 - 1.5 GL versions are supported. + major=0; + } else { + // make sure 2.0 is added .. + minor = 0; + availableExtensionCache.add("GL_VERSION_" + major + "_" + minor); + if (DEBUG) { + System.err.println("ExtensionAvailabilityCache: Added GL_VERSION_" + major + "_" + minor + " to known extensions"); + } } - - --major; + // Restart loop at version 1.5 + minor = 5; + break; + case 1: + break; } + + --major; } // put a dummy var in here so that the cache is no longer empty even if // no extensions are in the GL_EXTENSIONS string availableExtensionCache.add(""); + + initialized = true; } } @@ -146,6 +257,11 @@ public final class ExtensionAvailabilityCache { // Internals only below this point // + private boolean initialized = false; + private int majorVersion = 1; + private int minorVersion = 0; + private String glExtensions = null; + private String glXExtensions = null; private HashSet availableExtensionCache = new HashSet(50); private GLContextImpl context; @@ -236,7 +352,7 @@ public final class ExtensionAvailabilityCache { { // FIXME: refactor desktop OpenGL dependencies and make this // class work properly for OpenGL ES - System.err.println("FunctionAvailabilityCache.Version.: "+e); + System.err.println("ExtensionAvailabilityCache: FunctionAvailabilityCache.Version.: "+e); major = 1; minor = 0; /* diff --git a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java index fa7e1ade7..16eb934bd 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java @@ -228,7 +228,7 @@ public abstract class GLContextImpl extends GLContext { return gl; } - public void setGL(GL gl) { + public GL setGL(GL gl) { if(DEBUG) { String sgl1 = (null!=this.gl)?this.gl.getClass().toString()+", "+this.gl.toString():new String(""); String sgl2 = (null!=gl)?gl.getClass().toString()+", "+gl.toString():new String(""); @@ -236,6 +236,7 @@ public abstract class GLContextImpl extends GLContext { e.printStackTrace(); } this.gl = gl; + return gl; } public abstract Object getPlatformGLExtensions(); @@ -354,7 +355,6 @@ public abstract class GLContextImpl extends GLContext { if(null==this.gl) { throw new GLException("setGLFunctionAvailability not called yet"); } - extensionAvailability.flush(); if (DEBUG) { System.err.println(getThreadName() + ": !!! Initializing OpenGL extension address table for " + this); } @@ -364,6 +364,8 @@ public abstract class GLContextImpl extends GLContext { // share them among contexts with the same capabilities } resetProcAddressTable(getGLProcAddressTable()); + + extensionAvailability.reset(); } /** @@ -426,6 +428,26 @@ public abstract class GLContextImpl extends GLContext { return extensionAvailability.isExtensionAvailable(mapToRealGLExtensionName(glExtensionName)); } + public String getPlatformExtensionsString() { + return extensionAvailability.getPlatformExtensionsString(); + } + + public String getGLExtensions() { + return extensionAvailability.getGLExtensions(); + } + + public int getMajorVersion() { + return extensionAvailability.getMajorVersion(); + } + + public int getMinorVersion() { + return extensionAvailability.getMinorVersion(); + } + + public boolean isExtensionCacheInitialized() { + return extensionAvailability.isInitialized(); + } + /** Indicates which floating-point pbuffer implementation is in use. Returns one of GLPbuffer.APPLE_FLOAT, GLPbuffer.ATI_FLOAT, or GLPbuffer.NV_FLOAT. */ diff --git a/src/jogl/classes/com/sun/opengl/impl/GLPbufferImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLPbufferImpl.java index e414fbc8e..8aba26fc6 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLPbufferImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLPbufferImpl.java @@ -129,8 +129,8 @@ public class GLPbufferImpl implements GLPbuffer { return getContext().getGL(); } - public void setGL(GL gl) { - getContext().setGL(gl); + public GL setGL(GL gl) { + return getContext().setGL(gl); } public void setAutoSwapBufferMode(boolean onOrOff) { diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/FixedFuncUtil.java b/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/FixedFuncUtil.java index 9c8a65173..4149aec69 100644 --- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/FixedFuncUtil.java +++ b/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/FixedFuncUtil.java @@ -14,12 +14,12 @@ import com.sun.opengl.util.glsl.fixedfunc.impl.*; */ public class FixedFuncUtil { /** - * @return If gl is a GL2ES1, return the type cast object, + * @return If gl is a GL2ES1 and force is false, return the type cast object, * otherwise create a fixed function emulation pipeline with the GL2ES2 impl. * @throws GLException if the GL object is neither GL2ES1 nor GL2ES2 */ - public static final GL2ES1 getFixedFuncImpl(GL gl) { - if(gl.isGL2ES1()) { + public static final GL2ES1 getFixedFuncImpl(GL gl, boolean force) { + if(!force && gl.isGL2ES1()) { return gl.getGL2ES1(); } else if(gl.isGL2ES2()) { GL2ES2 es2 = gl.getGL2ES2(); @@ -31,6 +31,15 @@ public class FixedFuncUtil { throw new GLException("GL Object is neither GL2ES1 nor GL2ES2"); } + /** + * @return If gl is a GL2ES1, return the type cast object, + * otherwise create a fixed function emulation pipeline with the GL2ES2 impl. + * @throws GLException if the GL object is neither GL2ES1 nor GL2ES2 + */ + public static final GL2ES1 getFixedFuncImpl(GL gl) { + return getFixedFuncImpl(gl, false); + } + /** * Mapping fixed function (client) array indices to * GLSL array attribute names. diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java index 43347c416..a94c14f33 100644 --- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java @@ -208,6 +208,7 @@ public interface GLAutoDrawable extends GLDrawable { This should only be called from within the GLEventListener's callback methods, and usually only from within the init() method, in order to install a composable pipeline. See the JOGL - demos for examples. */ - public void setGL(GL gl); + demos for examples. + @return the set GL pipeline or null if not successful */ + public GL setGL(GL gl); } diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index a2bff729a..8ff52b6e9 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -205,8 +205,10 @@ public abstract class GLContext { /** * Sets the GL pipeline object for this GLContext. + * + * @return the set GL pipeline or null if not successful */ - public abstract void setGL(GL gl); + public abstract GL setGL(GL gl); /** * Returns the attached user object for the given name to this GLContext. diff --git a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java new file mode 100644 index 000000000..bb9f86911 --- /dev/null +++ b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +package javax.media.opengl; + +import java.lang.reflect.*; +import java.util.StringTokenizer; + +import com.sun.opengl.impl.*; + +/** + * Factory for pipelining GL instances + */ +public class GLPipelineFactory { + public static final boolean DEBUG = Debug.debug("GLPipelineFactory"); + + /** + * Creates a pipelined GL instance using the given downstream downstream + * and optional arguments additionalArgs for the constructor.
    + * + * The upstream GL instance is determined as follows: + *

      + *
    • Use pipelineClazzBaseName as the class name's full basename, incl. package name
    • + *
    • For all downstream classes, do:
    • + *
        + *
      • For all downstream class interfaces, do:
      • + *
          + *
        • If reqInterface is not null and the interface is unequal, continue.
        • + *
        • If downstream is not instance of interface, continue.
        • + *
        • If downstream is not instance of interface, continue.
        • + *
        • If upstream class is available use it, end loop.
        • + *
        + *
      + *

    + * + * @arg pipelineClazzBaseName the basename of the pipline class name + * @arg reqInterface optional requested interface to be used, may be null, in which case the first matching one is used + * @arg downstream is always the 1st argument for the upstream constructor + * @arg additionalArgs additional arguments for the upstream constructor + */ + public static final GL create(String pipelineClazzBaseName, Class reqInterface, GL downstream, Object[] additionalArgs) { + Class downstreamClazz = downstream.getClass(); + Class upstreamClazz = null; + Class interfaceClazz = null; + + if(DEBUG) { + System.out.println("GLPipelineFactory: Start "+downstreamClazz.getName()+", req. Interface: "+reqInterface+" -> "+pipelineClazzBaseName); + } + + // For all classes: child -> parent + do { + // For all interfaces: right -> left == child -> parent + // It is important that this matches with the gluegen cfg file's 'Implements' clause ! + Class[] clazzes = downstreamClazz.getInterfaces(); + for(int i=clazzes.length-1; null==upstreamClazz && i>=0; i--) { + if(DEBUG) { + System.out.println("GLPipelineFactory: Try "+downstreamClazz.getName()+" Interface["+i+"]: "+clazzes[i].getName()); + } + if( reqInterface != null && !reqInterface.getName().equals(clazzes[i].getName()) ) { + if(DEBUG) { + System.out.println("GLPipelineFactory: requested Interface "+reqInterface+" is _not_ "+ clazzes[i].getName()); + } + continue; // not the requested one .. + } + if( ! clazzes[i].isInstance(downstream) ) { + if(DEBUG) { + System.out.println("GLPipelineFactory: "+downstream.getClass().getName() + " is _not_ instance of "+ clazzes[i].getName()); + } + continue; // not a compatible one + } else { + if(DEBUG) { + System.out.println("GLPipelineFactory: "+downstream.getClass().getName() + " _is_ instance of "+ clazzes[i].getName()); + } + } + upstreamClazz = getUpstreamClazz(clazzes[i], pipelineClazzBaseName); + if( null != upstreamClazz ) { + interfaceClazz = clazzes[i]; + } + } + + if(null==upstreamClazz) { + downstreamClazz = downstreamClazz.getSuperclass(); + } + } while (null!=downstreamClazz && null==upstreamClazz); + + + if(null==upstreamClazz) { + throw new GLException("No pipeline ("+pipelineClazzBaseName+"*) available for :"+downstream.getClass().getName()); + } + + if(DEBUG) { + System.out.println("GLPipelineFactory: Got : "+ upstreamClazz.getName()+", base interface: "+interfaceClazz.getName()); + } + + Class[] cstrArgTypes = new Class[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ; + { + int i = 0; + cstrArgTypes[i++] = interfaceClazz; + for(int j=0; null!=additionalArgs && j Date: Sat, 1 Aug 2009 09:16:10 -0700 Subject: Oops: Accidently removed AWT Display selection in NEWT --- src/newt/classes/com/sun/javafx/newt/Display.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/newt/classes/com/sun/javafx') diff --git a/src/newt/classes/com/sun/javafx/newt/Display.java b/src/newt/classes/com/sun/javafx/newt/Display.java index 04fdb0181..38d0021ce 100755 --- a/src/newt/classes/com/sun/javafx/newt/Display.java +++ b/src/newt/classes/com/sun/javafx/newt/Display.java @@ -52,6 +52,8 @@ public abstract class Display implements Runnable { displayClass = Class.forName("com.sun.javafx.newt.macosx.MacDisplay"); } else if (NativeWindowFactory.TYPE_X11.equals(type)) { displayClass = Class.forName("com.sun.javafx.newt.x11.X11Display"); + } else if (NativeWindowFactory.TYPE_AWT.equals(type)) { + displayClass = Class.forName("com.sun.javafx.newt.awt.AWTDisplay"); } else if (NewtFactory.TYPE_BROADCOM_EGL.equals(type)) { displayClass = Class.forName("com.sun.javafx.newt.opengl.broadcom.BCEGLDisplay"); } else { -- cgit v1.2.3