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 --- .../com/sun/opengl/impl/egl/EGLDrawable.java | 38 +++++++++++++++++----- .../opengl/impl/egl/EGLGraphicsConfiguration.java | 19 +++++++++-- 2 files changed, 46 insertions(+), 11 deletions(-) (limited to 'src/jogl/classes/com') 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(); } -- cgit v1.2.3 From b6d75cac68340878b20d35b23c8449c97ad9d819 Mon Sep 17 00:00:00 2001 From: Morris Meyer Date: Tue, 28 Jul 2009 17:34:20 -0400 Subject: EGL changes for device --- make/build-newt.xml | 1 + .../classes/com/sun/opengl/impl/GLDrawableImpl.java | 19 ++++++++++++++++++- .../com/sun/opengl/impl/egl/EGLDrawableFactory.java | 6 +++++- .../sun/opengl/impl/egl/EGLDynamicLookupHelper.java | 14 ++++++++++---- .../opengl/impl/egl/EGLES1DynamicLookupHelper.java | 2 ++ src/jogl/classes/javax/media/opengl/GLProfile.java | 6 +++--- .../com/sun/nativewindow/impl/NWReflection.java | 11 +++++++++-- .../javax/media/nativewindow/NativeWindowFactory.java | 5 +++++ src/newt/native/BroadcomEGL.c | 4 ++-- 9 files changed, 55 insertions(+), 13 deletions(-) (limited to 'src/jogl/classes/com') diff --git a/make/build-newt.xml b/make/build-newt.xml index 48c11f6dd..1ed039a57 100644 --- a/make/build-newt.xml +++ b/make/build-newt.xml @@ -371,6 +371,7 @@ + diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java index c381f68f5..e71cf33a0 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java @@ -52,7 +52,24 @@ public abstract class GLDrawableImpl implements GLDrawable { this.factory = factory; this.component = comp; this.realized = realized; - this.requestedCapabilities = (GLCapabilities)component.getGraphicsConfiguration().getNativeGraphicsConfiguration().getRequestedCapabilities(); // a copy .. + + 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 .. } /** 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 396580c1d..e2ee65d27 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java @@ -45,15 +45,19 @@ 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 8bed0eb35..99f163ca1 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 = com.sun.opengl.impl.Debug.debug("EGL"); + protected static final boolean DEBUG = true; /* com.sun.opengl.impl.Debug.debug("EGL"); */ private static final EGLDynamicLookupHelper eglES1DynamicLookupHelper; private static final EGLDynamicLookupHelper eglES2DynamicLookupHelper; @@ -136,9 +136,13 @@ public abstract class EGLDynamicLookupHelper implements DynamicLookupHelper { private NativeLibrary loadFirstAvailable(List/**/ libNames, ClassLoader loader) { for (Iterator iter = libNames.iterator(); iter.hasNext(); ) { - NativeLibrary lib = NativeLibrary.open((String) iter.next(), loader, false /*global*/); + String libname = (String) iter.next(); + NativeLibrary lib = NativeLibrary.open(libname, loader, false /*global*/); if (lib != null) { + System.out.println("found: " + libname); return lib; + } else { + System.out.println("looked for: " + libname); } } return null; @@ -164,9 +168,11 @@ 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); + // 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); } - glesLibraries.add(lib); } if (esProfile==2) { 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 7e60e25c0..68630344a 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLES1DynamicLookupHelper.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLES1DynamicLookupHelper.java @@ -58,6 +58,8 @@ 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/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index ead5f6396..83a9b0098 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 = Debug.debug("GLProfile"); + public static final boolean DEBUG = true; /* Debug.debug("GLProfile"); */ // // Public (user-visible) profiles @@ -736,8 +736,8 @@ public class GLProfile implements Cloneable { } } mappedProfiles = _mappedProfiles; // final .. - if(null==defaultGLProfile) { - throw new GLException("No profile available: "+list2String(GL_PROFILE_LIST_ALL)); + if (null==defaultGLProfile) { + System.out.println("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 b13cf4317..d054c205b 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 = Debug.debug("NWReflection"); + public static final boolean DEBUG = true; /* Debug.debug("NWReflection"); */ public static final boolean isClassAvailable(String clazzName) { try { @@ -69,7 +69,11 @@ public final class NWReflection { try { factory = factoryClass.getDeclaredConstructor( cstrArgTypes ); } catch(NoSuchMethodException nsme) { - throw new NativeWindowException("Constructor: '" + clazzName + "("+cstrArgTypes+")' not found"); + nsme.printStackTrace(); + throw new NativeWindowException("Constructor: '" + clazzName + "("+cstrArgTypes+")' not found"); + } catch (Throwable th) { + th.printStackTrace(); + throw new NativeWindowException(th); } return factory; } catch (Throwable e) { @@ -91,6 +95,9 @@ 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/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index cbd485649..d4684c783 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -48,6 +48,9 @@ import com.sun.nativewindow.impl.jvm.JVMUtil; public abstract class NativeWindowFactory { protected static final boolean DEBUG = Debug.debug("NativeWindow"); + /** Broadcom EGL type */ + public static final String TYPE_BROADCOM_EGL = "BroadcomEGL"; + /** OpenKODE/EGL type */ public static final String TYPE_EGL = "EGL"; @@ -82,6 +85,8 @@ public abstract class NativeWindowFactory { private static String _getNativeWindowingType(String osNameLowerCase) { if (osNameLowerCase.startsWith("kd")) { return TYPE_EGL; + } else if (osNameLowerCase.startsWith(TYPE_BROADCOM_EGL.toLowerCase())) { + return TYPE_BROADCOM_EGL; } else if (osNameLowerCase.startsWith("wind")) { return TYPE_WINDOWS; } else if (osNameLowerCase.startsWith("mac os x") || diff --git a/src/newt/native/BroadcomEGL.c b/src/newt/native/BroadcomEGL.c index 8afa71a47..55ca5f155 100755 --- a/src/newt/native/BroadcomEGL.c +++ b/src/newt/native/BroadcomEGL.c @@ -85,7 +85,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLDisplay_Cr { (void) env; (void) obj; - EGLDisplay dpy = EGLUtil_CreateDisplay( (GLuint) width, (GLuint) height ); + EGLDisplay dpy = EGLUtil_CreateDisplayByNative( (GLuint) width, (GLuint) height ); if(NULL==dpy) { fprintf(stderr, "[CreateDisplay] failed: NULL\n"); } else { @@ -131,7 +131,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_Cre return 0; } - window = EGLUtil_CreateWindow( dpy, chromaKey, &uiWidth, &uiHeight ); + window = EGLUtil_CreateWindowByNative( dpy, chromaKey, &uiWidth, &uiHeight ); // EGLUtil_DestroyWindow( dpy, window ); if(NULL==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/jogl/classes/com') 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/jogl/classes/com') 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 ce34e2286a1ef4f8be874144e25c0268a1abf90f Mon Sep 17 00:00:00 2001 From: sg215889 Date: Tue, 28 Jul 2009 20:20:02 -0700 Subject: Use getNativeWindowType(custom=true) for factory selection; Don't fail is non native OS factory is available --- .../com/sun/opengl/impl/egl/EGLDrawableFactory.java | 2 +- src/jogl/classes/javax/media/opengl/GLDrawableFactory.java | 14 +++++++++----- .../com/sun/nativewindow/impl/NativeWindowFactoryImpl.java | 2 +- .../media/nativewindow/GraphicsConfigurationFactory.java | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src/jogl/classes/com') 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 396580c1d..7af45d683 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java @@ -50,7 +50,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { new EGLGraphicsConfigurationFactory(); // Check for other underlying stuff .. - if(NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(false))) { + if(NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(true))) { try { NWReflection.createInstance("com.sun.opengl.impl.x11.glx.X11GLXGraphicsConfigurationFactory"); } catch (Throwable t) {} diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index cee721fa6..5a761119f 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -106,16 +106,14 @@ public abstract class GLDrawableFactory { } eglFactory = tmp; - nativeOSType = NativeWindowFactory.getNativeWindowType(false); + nativeOSType = NativeWindowFactory.getNativeWindowType(true); String factoryClassName = null; tmp = null; try { factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true, AccessController.getContext()); if (null == factoryClassName) { - if ( nativeOSType.equals(NativeWindowFactory.TYPE_EGL) ) { - // use egl*Factory .. - } else if ( nativeOSType.equals(NativeWindowFactory.TYPE_X11) ) { + if ( nativeOSType.equals(NativeWindowFactory.TYPE_X11) ) { factoryClassName = "com.sun.opengl.impl.x11.glx.X11GLXDrawableFactory"; } else if ( nativeOSType.equals(NativeWindowFactory.TYPE_WINDOWS) ) { factoryClassName = "com.sun.opengl.impl.windows.wgl.WindowsWGLDrawableFactory"; @@ -126,10 +124,16 @@ public abstract class GLDrawableFactory { factoryClassName = macosxFactoryClassNameCGL; } } else { - throw new GLException("Unsupported NativeWindow type: "+nativeOSType); + // may use egl*Factory .. + if (GLProfile.DEBUG) { + System.err.println("GLDrawableFactory.static - No Native OS Factory for: "+nativeOSType); + } } } if (null != factoryClassName) { + if (GLProfile.DEBUG) { + System.err.println("GLDrawableFactory.static - Native OS Factory for: "+nativeOSType+": "+factoryClassName); + } tmp = (GLDrawableFactory) NWReflection.createInstance(factoryClassName); } } catch (Throwable t) { diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/NativeWindowFactoryImpl.java b/src/nativewindow/classes/com/sun/nativewindow/impl/NativeWindowFactoryImpl.java index 424b44c8c..c94dab2f6 100644 --- a/src/nativewindow/classes/com/sun/nativewindow/impl/NativeWindowFactoryImpl.java +++ b/src/nativewindow/classes/com/sun/nativewindow/impl/NativeWindowFactoryImpl.java @@ -69,7 +69,7 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory { private NativeWindow getAWTNativeWindow(Object winObj, AbstractGraphicsConfiguration config) { if (nativeWindowConstructor == null) { try { - String osType = getNativeWindowType(false); + String osType = getNativeWindowType(true); String windowClassName = null; // We break compile-time dependencies on the AWT here to diff --git a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java index 1a9d4ac55..881499bec 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java @@ -74,7 +74,7 @@ public abstract class GraphicsConfigurationFactory { abstractGraphicsDeviceClass = javax.media.nativewindow.AbstractGraphicsDevice.class; - if (NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(false))) { + if (NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(true))) { try { GraphicsConfigurationFactory factory = (GraphicsConfigurationFactory) NWReflection.createInstance("com.sun.nativewindow.impl.x11.X11GraphicsConfigurationFactory", new Object[] {}); -- 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/jogl/classes/com') 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 b00c6b4d36d60bc3a29a4458e42fb29c9a9ca941 Mon Sep 17 00:00:00 2001 From: sg215889 Date: Wed, 29 Jul 2009 02:49:40 -0700 Subject: Refine debug message --- .../classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java | 9 +++++++-- src/jogl/classes/javax/media/opengl/GLProfile.java | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src/jogl/classes/com') 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 8bed0eb35..02aed9788 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java @@ -42,6 +42,7 @@ import com.sun.opengl.impl.*; import com.sun.nativewindow.impl.*; import com.sun.gluegen.runtime.NativeLibrary; import com.sun.gluegen.runtime.DynamicLookupHelper; +import java.security.*; /** * Abstract implementation of the DynamicLookupHelper for EGL, @@ -51,12 +52,16 @@ import com.sun.gluegen.runtime.DynamicLookupHelper; */ public abstract class EGLDynamicLookupHelper implements DynamicLookupHelper { protected static final boolean DEBUG = com.sun.opengl.impl.Debug.debug("EGL"); + protected static final boolean DEBUG_LOOKUP; private static final EGLDynamicLookupHelper eglES1DynamicLookupHelper; private static final EGLDynamicLookupHelper eglES2DynamicLookupHelper; private List/**/ glesLibraries; static { + AccessControlContext localACC=AccessController.getContext(); + DEBUG_LOOKUP = com.sun.opengl.impl.Debug.isPropertyDefined("jogl.debug.DynamicLookup", true, localACC); + EGLDynamicLookupHelper tmp=null; try { tmp = new EGLES1DynamicLookupHelper(); @@ -190,7 +195,7 @@ public abstract class EGLDynamicLookupHelper implements DynamicLookupHelper { addr = dynamicLookupFunctionOnLibsImpl(funcName); } } - if(DEBUG) { + if(DEBUG_LOOKUP) { if(0!=addr) { System.err.println("Lookup-Native: "+glFuncName+" / "+funcName+" 0x"+Long.toHexString(addr)); } else { @@ -236,7 +241,7 @@ public abstract class EGLDynamicLookupHelper implements DynamicLookupHelper { } long addr = EGL.eglGetProcAddress(eglGetProcAddressHandle, glFuncName); - if(DEBUG) { + if(DEBUG_LOOKUP) { if(0!=addr) { System.err.println("Lookup-EGL: <"+glFuncName+"> 0x"+Long.toHexString(addr)); } diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index ead5f6396..6dab57469 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -709,6 +709,8 @@ public class GLProfile implements Cloneable { System.err.println("GLProfile.static hasGL3Impl "+hasGL3Impl); System.err.println("GLProfile.static hasGL2Impl "+hasGL2Impl); System.err.println("GLProfile.static hasGL2ES12Impl "+hasGL2ES12Impl); + System.err.println("GLProfile.static hasEGLDynLookup "+hasEGLDynLookup); + System.err.println("GLProfile.static hasEGLDrawableFactory "+hasEGLDrawableFactory); System.err.println("GLProfile.static hasGLES2Impl "+hasGLES2Impl); System.err.println("GLProfile.static hasGLES1Impl "+hasGLES1Impl); } -- 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/jogl/classes/com') 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 cd1c18244cec90575cdcc2039db42596d438cd90 Mon Sep 17 00:00:00 2001 From: sg215889 Date: Wed, 29 Jul 2009 20:03:56 -0700 Subject: eglBindAPI optional --- src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/jogl/classes/com') diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java index 653bddb9d..45fe0fcd3 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java @@ -168,8 +168,15 @@ public abstract class EGLContext extends GLContextImpl { throw new GLException("Error: attempted to create an OpenGL context without a graphics configuration"); } - if(!EGL.eglBindAPI(EGL.EGL_OPENGL_ES_API)) { - throw new GLException("eglBindAPI to ES failed , error 0x"+Integer.toHexString(EGL.eglGetError())); + try { + // might be unavailable on EGL < 1.2 + if(!EGL.eglBindAPI(EGL.EGL_OPENGL_ES_API)) { + throw new GLException("eglBindAPI to ES failed , error 0x"+Integer.toHexString(EGL.eglGetError())); + } + } catch (GLException glex) { + if (DEBUG) { + glex.printStackTrace(); + } } EGLContext other = (EGLContext) GLContextShareSet.getShareContext(this); -- cgit v1.2.3 From 9a4619d5ab1c0441dfb273d057e288b4bf4c6dbc Mon Sep 17 00:00:00 2001 From: sg215889 Date: Thu, 30 Jul 2009 22:09:24 -0700 Subject: Fix SwapInterval (return value, check ctx current, egl), add getSwapInterval. --- make/config/jogl/gl-impl-CustomJavaCode-gl2.java | 4 ++++ .../jogl/gl-impl-CustomJavaCode-gl2es12.java | 4 ++++ make/config/jogl/gl-impl-CustomJavaCode-gl3.java | 4 ++++ make/config/jogl/gl-impl-CustomJavaCode-gles1.java | 4 ++++ make/config/jogl/gl-impl-CustomJavaCode-gles2.java | 4 ++++ .../classes/com/sun/opengl/impl/GLContextImpl.java | 20 +++++++++++++---- .../com/sun/opengl/impl/egl/EGLContext.java | 6 ++++++ .../opengl/impl/macosx/cgl/MacOSXCGLContext.java | 3 ++- .../impl/macosx/cgl/MacOSXPbufferCGLContext.java | 13 ++++++++++- .../macosx/cgl/awt/MacOSXJava2DCGLContext.java | 4 ---- .../opengl/impl/windows/wgl/WindowsWGLContext.java | 25 ++++------------------ .../com/sun/opengl/impl/x11/glx/X11GLXContext.java | 8 +++---- src/jogl/classes/javax/media/opengl/GLBase.java | 17 ++++++++++++++- 13 files changed, 80 insertions(+), 36 deletions(-) (limited to 'src/jogl/classes/com') diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl2.java b/make/config/jogl/gl-impl-CustomJavaCode-gl2.java index 5aec51fc7..061830cb4 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl2.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl2.java @@ -126,6 +126,10 @@ public void setSwapInterval(int interval) { _context.setSwapInterval(interval); } +public int getSwapInterval() { + return _context.getSwapInterval(); +} + public Object getPlatformGLExtensions() { return _context.getPlatformGLExtensions(); } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java b/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java index cb4cab175..3dfcf5908 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java @@ -127,6 +127,10 @@ public void setSwapInterval(int interval) { _context.setSwapInterval(interval); } +public int getSwapInterval() { + return _context.getSwapInterval(); +} + public Object getPlatformGLExtensions() { return _context.getPlatformGLExtensions(); } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl3.java b/make/config/jogl/gl-impl-CustomJavaCode-gl3.java index a15964bcc..9123f35c8 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl3.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl3.java @@ -126,6 +126,10 @@ public void setSwapInterval(int interval) { _context.setSwapInterval(interval); } +public int getSwapInterval() { + return _context.getSwapInterval(); +} + public Object getPlatformGLExtensions() { return _context.getPlatformGLExtensions(); } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java index 5141376df..65236676a 100755 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java @@ -101,6 +101,10 @@ public void setSwapInterval(int interval) { _context.setSwapInterval(interval); } +public int getSwapInterval() { + return _context.getSwapInterval(); +} + public Object getPlatformGLExtensions() { return _context.getPlatformGLExtensions(); } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java index b53715ae0..2f69905a9 100755 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java @@ -105,6 +105,10 @@ public void setSwapInterval(int interval) { _context.setSwapInterval(interval); } +public int getSwapInterval() { + return _context.getSwapInterval(); +} + public Object getPlatformGLExtensions() { return _context.getPlatformGLExtensions(); } diff --git a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java index c60cccec6..fa7e1ade7 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java @@ -284,11 +284,23 @@ public abstract class GLContextImpl extends GLContext { public abstract ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3); - /* - * Sets the swap interval for onscreen OpenGL contexts. Has no - * effect for offscreen contexts. - */ public void setSwapInterval(final int interval) { + GLContext current = getCurrent(); + if (current != this) { + throw new GLException("This context is not current. Current context: "+current+ + ", this context "+this); + } + setSwapIntervalImpl(interval); + } + + protected int currentSwapInterval = -1; // default: not set yet .. + + public int getSwapInterval() { + return currentSwapInterval; + } + + protected void setSwapIntervalImpl(final int interval) { + // nop per default .. } /** Maps the given "platform-independent" function name to a real function diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java index 45fe0fcd3..1a75f03a9 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java @@ -261,6 +261,12 @@ public abstract class EGLContext extends GLContextImpl { } } + protected void setSwapIntervalImpl(int interval) { + if (EGL.eglSwapInterval(drawable.getDisplay(), interval)) { + currentSwapInterval = interval ; + } + } + public abstract void bindPbufferToTexture(); public abstract void releasePbufferFromTexture(); diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java index b424e9516..f60dd1645 100644 --- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java @@ -337,11 +337,12 @@ public abstract class MacOSXCGLContext extends GLContextImpl return ""; } - public void setSwapInterval(int interval) { + protected void setSwapIntervalImpl(int interval) { if (nsContext == 0) { throw new GLException("OpenGL context not current"); } CGL.setSwapInterval(nsContext, interval); + currentSwapInterval = interval ; } public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java index d702150d3..4ea3519bf 100644 --- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java @@ -121,11 +121,12 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { } } - public void setSwapInterval(int interval) { + protected void setSwapIntervalImpl(int interval) { if (nsContext == 0) { throw new GLException("OpenGL context not current"); } impl.setSwapInterval(nsContext, interval); + currentSwapInterval = impl.getSwapInterval() ; } public int getFloatingPointMode() { @@ -210,6 +211,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { public boolean makeCurrent(long ctx); public boolean release(long ctx); public void setSwapInterval(long ctx, int interval); + public int getSwapInterval(); } // NSOpenGLContext-based implementation @@ -241,8 +243,14 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { return CGL.clearCurrentContext(ctx); } + private int currentSwapInterval = 0 ; + public void setSwapInterval(long ctx, int interval) { CGL.setSwapInterval(ctx, interval); + currentSwapInterval = interval ; + } + public int getSwapInterval() { + return currentSwapInterval; } } @@ -344,5 +352,8 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { public void setSwapInterval(long ctx, int interval) { // For now not supported (not really relevant for off-screen contexts anyway) } + public int getSwapInterval() { + return 0; + } } } diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java index 4423f8da5..22b0ffe55 100644 --- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java @@ -144,10 +144,6 @@ public class MacOSXJava2DCGLContext extends MacOSXCGLContext implements Java2DGL } } - public void setSwapInterval(int interval) { - // Not supported in this context implementation - } - public void setOpenGLMode(int mode) { if (mode != MacOSXCGLDrawable.CGL_MODE) throw new GLException("OpenGL mode switching not supported for Java2D GLContexts"); 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 1bc3acada..92a563445 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 @@ -332,29 +332,12 @@ public class WindowsWGLContext extends GLContextImpl { } } - public boolean isFunctionAvailable(String glFunctionName) - { - boolean available = super.isFunctionAvailable(glFunctionName); - - // Sanity check for implementations that use proc addresses for run-time - // linking: if the function IS available, then make sure there's a proc - // address for it if it's an extension or not part of the OpenGL 1.1 core - // (post GL 1.1 functions are run-time linked on windows). - /* FIXME: - assert(!available || - (getGLProcAddressTable().getAddressFor(mapToRealGLFunctionName(glFunctionName)) != 0 || - FunctionAvailabilityCache.isPartOfGLCore("1.1", mapToRealGLFunctionName(glFunctionName))) - ); */ - - return available; - } - - public void setSwapInterval(int interval) { - // FIXME: make the context current first? Currently assumes that - // will not be necessary. Make the caller do this? + protected void setSwapIntervalImpl(int interval) { WGLExt wglExt = getWGLExt(); if (wglExt.isExtensionAvailable("WGL_EXT_swap_control")) { - wglExt.wglSwapIntervalEXT(interval); + if ( wglExt.wglSwapIntervalEXT(interval) ) { + currentSwapInterval = interval ; + } } } diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java index 57abcf588..718d55aa0 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java @@ -396,11 +396,9 @@ public abstract class X11GLXContext extends GLContextImpl { private int hasSwapIntervalSGI = 0; - public void setSwapInterval(int interval) { + protected void setSwapIntervalImpl(int interval) { getDrawableImpl().getFactoryImpl().lockToolkit(); try { - // FIXME: make the context current first? Currently assumes that - // will not be necessary. Make the caller do this? GLXExt glXExt = getGLXExt(); if(0==hasSwapIntervalSGI) { try { @@ -409,7 +407,9 @@ public abstract class X11GLXContext extends GLContextImpl { } if (hasSwapIntervalSGI>0) { try { - glXExt.glXSwapIntervalSGI(interval); + if( 0 == glXExt.glXSwapIntervalSGI(interval) ) { + currentSwapInterval = interval; + } } catch (Throwable t) { hasSwapIntervalSGI=-1; } } } finally { diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java index 7b59344cc..92498077b 100644 --- a/src/jogl/classes/javax/media/opengl/GLBase.java +++ b/src/jogl/classes/javax/media/opengl/GLBase.java @@ -227,9 +227,24 @@ public interface GLBase { 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. */ + onscreen components. + + @see #getSwapInterval + @throws GLException if this context is not the current + */ public void setSwapInterval(int interval); + /** Provides a platform-independent way to get the swap + interval set by {@link #setSwapInterval}.
+ + If the interval is not set by {@link #setSwapInterval} yet, + -1 is returned, indicating that the platforms default + is being used. + + @see #setSwapInterval + */ + public int getSwapInterval(); + /** * Returns an object through which platform-specific OpenGL extensions * (EGL, GLX, WGL, etc.) may be accessed. The data type of the returned -- 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/jogl/classes/com') 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/jogl/classes/com') 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 07:20:33 -0700 Subject: Cleanup GLSL ShaderUtil/Code; Add dumpCode --- .../com/sun/opengl/util/glsl/ShaderCode.java | 98 +++++++++------------- .../com/sun/opengl/util/glsl/ShaderState.java | 10 ++- .../com/sun/opengl/util/glsl/ShaderUtil.java | 78 +++++++++++++++++ 3 files changed, 124 insertions(+), 62 deletions(-) (limited to 'src/jogl/classes/com') diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/sun/opengl/util/glsl/ShaderCode.java index 6e7512e6a..606d2e1b5 100644 --- a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderCode.java +++ b/src/jogl/classes/com/sun/opengl/util/glsl/ShaderCode.java @@ -3,13 +3,18 @@ package com.sun.opengl.util.glsl; import javax.media.opengl.*; import com.sun.opengl.util.*; +import com.sun.opengl.impl.Debug; import java.util.*; import java.nio.*; import java.io.*; import java.net.*; +import java.security.*; public class ShaderCode { + public static final boolean DEBUG = Debug.debug("GLSLCode"); + public static final boolean DEBUG_CODE = Debug.isPropertyDefined("jogl.debug.GLSLCode", true, AccessController.getContext()); + public static final String SUFFIX_VERTEX_SOURCE = "vp" ; public static final String SUFFIX_VERTEX_BINARY = "bvp" ; public static final String SUFFIX_FRAGMENT_SOURCE = "fp" ; @@ -31,6 +36,11 @@ public class ShaderCode { shaderType = type; shader = BufferUtil.newIntBuffer(number); id = getNextID(); + + if(DEBUG_CODE) { + System.out.println("Created: "+toString()); + dumpShaderSource(System.out); + } } public ShaderCode(int type, int number, int binFormat, Buffer binary) { @@ -134,61 +144,6 @@ public class ShaderCode { return res; } - public static boolean createAndLoadShader(GL2ES2 gl, IntBuffer shader, int shaderType, - int binFormat, java.nio.Buffer bin, - PrintStream verboseOut) - { - int err = gl.glGetError(); // flush previous errors .. - if(err!=GL.GL_NO_ERROR && null!=verboseOut) { - verboseOut.println("createAndLoadShader: Pre GL Error: 0x"+Integer.toHexString(err)); - } - - ShaderUtil.createShader(gl, shaderType, shader); - err = gl.glGetError(); - if(err!=GL.GL_NO_ERROR) { - throw new GLException("createAndLoadShader: CreateShader failed, GL Error: 0x"+Integer.toHexString(err)); - } - - - ShaderUtil.shaderBinary(gl, shader, binFormat, bin); - - err = gl.glGetError(); - if(err!=GL.GL_NO_ERROR && null!=verboseOut) { - verboseOut.println("createAndLoadShader: ShaderBinary failed, GL Error: 0x"+Integer.toHexString(err)); - } - return err == GL.GL_NO_ERROR; - } - - public static boolean createAndCompileShader(GL2ES2 gl, IntBuffer shader, int shaderType, - java.lang.String[][] sources, - PrintStream verboseOut) - { - int err = gl.glGetError(); // flush previous errors .. - if(err!=GL.GL_NO_ERROR && null!=verboseOut) { - verboseOut.println("createAndCompileShader: Pre GL Error: 0x"+Integer.toHexString(err)); - } - - ShaderUtil.createShader(gl, shaderType, shader); - err = gl.glGetError(); - if(err!=GL.GL_NO_ERROR) { - throw new GLException("createAndCompileShader: CreateShader failed, GL Error: 0x"+Integer.toHexString(err)); - } - - ShaderUtil.shaderSource(gl, shader, sources); - err = gl.glGetError(); - if(err!=GL.GL_NO_ERROR) { - throw new GLException("createAndCompileShader: ShaderSource failed, GL Error: 0x"+Integer.toHexString(err)); - } - - ShaderUtil.compileShader(gl, shader); - err = gl.glGetError(); - if(err!=GL.GL_NO_ERROR && null!=verboseOut) { - verboseOut.println("createAndCompileShader: CompileShader failed, GL Error: 0x"+Integer.toHexString(err)); - } - - return ShaderUtil.isShaderStatusValid(gl, shader, gl.GL_COMPILE_STATUS, verboseOut) && err == GL.GL_NO_ERROR; - } - /** * returns the uniq shader id as an integer * @see #key() @@ -231,11 +186,11 @@ public class ShaderCode { // Create & Compile the vertex/fragment shader objects if(null!=shaderSource) { - valid=createAndCompileShader(gl, shader, shaderType, - shaderSource, verboseOut); + valid=ShaderUtil.createAndCompileShader(gl, shader, shaderType, + shaderSource, verboseOut); } else if(null!=shaderBinary) { - valid=createAndLoadShader(gl, shader, shaderType, - shaderBinaryFormat, shaderBinary, verboseOut); + valid=ShaderUtil.createAndLoadShader(gl, shader, shaderType, + shaderBinaryFormat, shaderBinary, verboseOut); } else { throw new GLException("no code (source or binary)"); } @@ -282,6 +237,31 @@ public class ShaderCode { return buf.toString(); } + public void dumpShaderSource(PrintStream out) { + if(null==shaderSource) { + out.println(""); + return; + } + int sourceNum = (null!=shaderSource)?shaderSource.length:0; + int shaderNum = (null!=shader)?shader.capacity():0; + for(int i=0; i=sourceNum) { + out.println(""); + } else { + String[] src = shaderSource[i]; + for(int j=0; j "+newId+"\n\t"+shaderProgram+"\n\t"+prog); - Throwable tX = new Throwable("Info: attachShaderProgram: Trace"); - tX.printStackTrace(); + if(verbose) { + Throwable tX = new Throwable("Info: attachShaderProgram: Trace"); + tX.printStackTrace(); + } } if(null!=shaderProgram) { if(shaderProgram.equals(prog)) { @@ -635,7 +640,6 @@ public class ShaderState { return buf.toString(); } - protected static final boolean DEBUG = false; protected boolean verbose = false; protected ShaderProgram shaderProgram=null; protected HashMap attribMap2Idx = new HashMap(); diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/sun/opengl/util/glsl/ShaderUtil.java index d1bb8b32b..390fb27c7 100644 --- a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderUtil.java +++ b/src/jogl/classes/com/sun/opengl/util/glsl/ShaderUtil.java @@ -60,6 +60,14 @@ public class ShaderUtil { public abstract void attachShader(GL gl, int program, IntBuffer shaders); public abstract void detachShader(GL gl, int program, IntBuffer shaders); public abstract void deleteShader(GL gl, IntBuffer shaders); + + public abstract boolean createAndLoadShader(GL gl, IntBuffer shader, int shaderType, + int binFormat, java.nio.Buffer bin, + PrintStream verboseOut); + + public abstract boolean createAndCompileShader(GL gl, IntBuffer shader, int shaderType, + java.lang.String[][] sources, + PrintStream verboseOut); } static class GL2ES2Impl extends Impl { @@ -307,6 +315,64 @@ public class ShaderUtil { } } + + public boolean createAndLoadShader(GL _gl, IntBuffer shader, int shaderType, + int binFormat, java.nio.Buffer bin, + PrintStream verboseOut) + { + GL2ES2 gl = _gl.getGL2ES2(); + int err = gl.glGetError(); // flush previous errors .. + if(err!=GL.GL_NO_ERROR && null!=verboseOut) { + verboseOut.println("createAndLoadShader: Pre GL Error: 0x"+Integer.toHexString(err)); + } + + createShader(gl, shaderType, shader); + err = gl.glGetError(); + if(err!=GL.GL_NO_ERROR) { + throw new GLException("createAndLoadShader: CreateShader failed, GL Error: 0x"+Integer.toHexString(err)); + } + + + shaderBinary(gl, shader, binFormat, bin); + + err = gl.glGetError(); + if(err!=GL.GL_NO_ERROR && null!=verboseOut) { + verboseOut.println("createAndLoadShader: ShaderBinary failed, GL Error: 0x"+Integer.toHexString(err)); + } + return err == GL.GL_NO_ERROR; + } + + public boolean createAndCompileShader(GL _gl, IntBuffer shader, int shaderType, + java.lang.String[][] sources, + PrintStream verboseOut) + { + GL2ES2 gl = _gl.getGL2ES2(); + int err = gl.glGetError(); // flush previous errors .. + if(err!=GL.GL_NO_ERROR && null!=verboseOut) { + verboseOut.println("createAndCompileShader: Pre GL Error: 0x"+Integer.toHexString(err)); + } + + createShader(gl, shaderType, shader); + err = gl.glGetError(); + if(err!=GL.GL_NO_ERROR) { + throw new GLException("createAndCompileShader: CreateShader failed, GL Error: 0x"+Integer.toHexString(err)); + } + + shaderSource(gl, shader, sources); + err = gl.glGetError(); + if(err!=GL.GL_NO_ERROR) { + throw new GLException("createAndCompileShader: ShaderSource failed, GL Error: 0x"+Integer.toHexString(err)); + } + + compileShader(gl, shader); + err = gl.glGetError(); + if(err!=GL.GL_NO_ERROR && null!=verboseOut) { + verboseOut.println("createAndCompileShader: CompileShader failed, GL Error: 0x"+Integer.toHexString(err)); + } + + return isShaderStatusValid(gl, shader, gl.GL_COMPILE_STATUS, verboseOut) && err == GL.GL_NO_ERROR; + } + } public static String getShaderInfoLog(GL gl, int shaderObj) { @@ -385,6 +451,18 @@ public class ShaderUtil { getImpl(gl).deleteShader(gl, shaders); } + public static boolean createAndLoadShader(GL gl, IntBuffer shader, int shaderType, + int binFormat, java.nio.Buffer bin, + PrintStream verboseOut) { + return getImpl(gl).createAndLoadShader(gl, shader, shaderType, binFormat, bin, verboseOut); + } + + public static boolean createAndCompileShader(GL gl, IntBuffer shader, int shaderType, + java.lang.String[][] sources, + PrintStream verboseOut) { + return getImpl(gl).createAndCompileShader(gl, shader, shaderType, sources, verboseOut); + } + private static Impl getImpl(GL _gl) { GL2ES2 gl = _gl.getGL2ES2(); GLContext context = gl.getContext(); -- cgit v1.2.3 From 598c3b25c3bb6a8e46f8d9c3045fc7a196ac5342 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 1 Aug 2009 07:45:23 -0700 Subject: Fix: updateGLProcAddressTable() call order - child before parent, broke WGL --- src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java | 2 +- src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java | 2 +- src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java | 2 +- src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/jogl/classes/com') diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java index 1a75f03a9..cc4dafa4c 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java @@ -225,7 +225,6 @@ public abstract class EGLContext extends GLContextImpl { } protected void updateGLProcAddressTable() { - super.updateGLProcAddressTable(); if (DEBUG) { System.err.println(getThreadName() + ": !!! Initializing EGL extension address table"); } @@ -235,6 +234,7 @@ public abstract class EGLContext extends GLContextImpl { eglExtProcAddressTable = new EGLExtProcAddressTable(); } resetProcAddressTable(getEGLExtProcAddressTable()); + super.updateGLProcAddressTable(); } public synchronized String getPlatformExtensionsString() { diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java index f60dd1645..181efc8bb 100644 --- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java @@ -320,7 +320,6 @@ public abstract class MacOSXCGLContext extends GLContextImpl } protected void updateGLProcAddressTable() { - super.updateGLProcAddressTable(); if (DEBUG) { System.err.println("!!! Initializing CGL extension address table"); } @@ -330,6 +329,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl cglExtProcAddressTable = new CGLExtProcAddressTable(); } resetProcAddressTable(getCGLExtProcAddressTable()); + super.updateGLProcAddressTable(); } public String getPlatformExtensionsString() 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 578279586..6d810ed39 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 @@ -313,7 +313,6 @@ public class WindowsWGLContext extends GLContextImpl { } protected void updateGLProcAddressTable() { - super.updateGLProcAddressTable(); if (DEBUG) { System.err.println(getThreadName() + ": !!! Initializing WGL extension address table for " + this); } @@ -323,6 +322,7 @@ public class WindowsWGLContext extends GLContextImpl { wglExtProcAddressTable = new WGLExtProcAddressTable(); } resetProcAddressTable(getWGLExtProcAddressTable()); + super.updateGLProcAddressTable(); } public String getPlatformExtensionsString() { diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java index 718d55aa0..da1548d0d 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java @@ -349,7 +349,6 @@ public abstract class X11GLXContext extends GLContextImpl { } protected void updateGLProcAddressTable() { - super.updateGLProcAddressTable(); if (DEBUG) { System.err.println(getThreadName() + ": !!! Initializing GLX extension address table"); } @@ -359,6 +358,7 @@ public abstract class X11GLXContext extends GLContextImpl { glXExtProcAddressTable = new GLXExtProcAddressTable(); } resetProcAddressTable(getGLXExtProcAddressTable()); + super.updateGLProcAddressTable(); } public synchronized String getPlatformExtensionsString() { -- cgit v1.2.3 From 91e2508661f8f922afad6379e8bcadee37900546 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 2 Aug 2009 04:30:53 -0700 Subject: Update documentation (OpenGL 3.0, 3.1 specifics); Fix ExtensionAvailabilityCache: Add Version 2.1 in case of GL2/OpenGL 3.0 --- make/config/jogl/gl-common.cfg | 13 ++++++++++--- make/doc/jogl/spec-overview.html | 9 ++++++++- .../com/sun/opengl/impl/ExtensionAvailabilityCache.java | 15 ++++++--------- 3 files changed, 24 insertions(+), 13 deletions(-) (limited to 'src/jogl/classes/com') diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg index 3e38aa0da..7cf51fda5 100644 --- a/make/config/jogl/gl-common.cfg +++ b/make/config/jogl/gl-common.cfg @@ -585,7 +585,8 @@ ClassJavadoc GL2ES2 */ ClassJavadoc GL2GL3 /** ClassJavadoc GL2GL3 *

-ClassJavadoc GL2GL3 * Interface containing the common subset of GL3 and GL2.
+ClassJavadoc GL2GL3 * Interface containing the common subset of GL3 (OpenGL 3.1+) and GL2 (OpenGL 3.0), +ClassJavadoc GL2GL3 * also known as the OpenGL 3.0 forward compatible, non deprecated subset.
ClassJavadoc GL2GL3 * This interface reflects only the programmable shader functionality of desktop OpenGL
ClassJavadoc GL2GL3 *

ClassJavadoc GL2GL3 */ @@ -596,15 +597,21 @@ ClassJavadoc GL2 * This interface contains all core desktop OpenGL methods thro 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 3.0, inclusive, are specifically -ClassJavadoc GL2 * excluded. +ClassJavadoc GL2 * excluded.
+ClassJavadoc GL2 * Note: OpenGL 3.0 is the last subsumed version in the specification. +ClassJavadoc GL2 * You need to use a {@link GL3} OpenGL 3.1+ context to benefit +ClassJavadoc GL2 * from new functionality and versions. 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 * inclusive - forward compatible, as well as most of it's extensions defined at the ClassJavadoc GL3 * time of this specification.
+ClassJavadoc GL3 * Note: OpenGL 3.0 forward compatible, non deprecated functionality is included in the +ClassJavadoc GL3 * 3.1 specification, hence the {@link GL2GL3} implemented interface.
+ClassJavadoc GL3 * Note: OpenGL 3.1 (forward compatible) no more includes fixed point functionality. ClassJavadoc GL3 *

ClassJavadoc GL3 */ diff --git a/make/doc/jogl/spec-overview.html b/make/doc/jogl/spec-overview.html index f79e5ff23..6557e9f7a 100644 --- a/make/doc/jogl/spec-overview.html +++ b/make/doc/jogl/spec-overview.html @@ -55,6 +55,9 @@ version 3.0, inclusive, as well as most of it's extensions defined at the time of this specification. Early OpenGL extensions whose functionality was incorporated into core OpenGL by version 3.0, inclusive, are specifically excluded.
+ Note: OpenGL 3.0 is the last subsumed version in the specification. + You need to use a {@link javax.media.opengl.GL3} OpenGL 3.1+ context to benefit + from new functionality and versions.
Future extensions will be added with a maintenance update
  • {@link javax.media.opengl.GL3 javax.media.opengl.GL3} interface
    @@ -62,6 +65,9 @@ excluded.
    This interface contains all core desktop OpenGL methods starting from 3.1, inclusive - forward compatible only, as well as most of it's extensions defined at the time of this specification.
    + Note: OpenGL 3.0 forward compatible, non deprecated functionality is included in the + 3.1 specification, hence the {@link javax.media.opengl.GL2GL3} implemented interface.
    + Note: OpenGL 3.1 (forward compatible) no more includes fixed point functionality.
    Future extensions will be added with a maintenance update

  • {@link javax.media.opengl.GLES1 javax.media.opengl.GLES1} interface
    @@ -105,7 +111,8 @@ time of this specification.
  • {@link javax.media.opengl.GL2GL3 javax.media.opengl.GL2GL3} interface

    - Interface containing the common subset of GL3 and GL2.
    + Interface containing the common subset of GL3 (OpenGL 3.1+) and GL2 (OpenGL 2.0), + also known as the OpenGL 3.0 forward compatible, non deprecated subset.
    This interface reflects only the programmable shader functionality of desktop OpenGL


  • diff --git a/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java b/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java index 7931f791b..26072519e 100644 --- a/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java +++ b/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java @@ -212,19 +212,16 @@ public final class ExtensionAvailabilityCache { } switch (major) { - case 2: - if(gl.isGL3() && major==2) { + case 3: + if(gl.isGL3()) { // 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"); - } } + // Restart loop at version 2.1 + minor = 1; + break; + case 2: // Restart loop at version 1.5 minor = 5; break; -- cgit v1.2.3 From 363fe8afc173ec9bf7fda4f863ddd14cd5ceabb5 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 2 Aug 2009 04:54:41 -0700 Subject: Fix doc bug @arg -> @param --- make/config/jogl/gl-common.cfg | 2 +- make/doc/jogl/spec-overview.html | 2 +- .../classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java | 2 +- src/jogl/classes/com/sun/opengl/util/GLArrayDataClient.java | 10 +++++----- src/jogl/classes/com/sun/opengl/util/GLArrayDataServer.java | 10 +++++----- src/jogl/classes/com/sun/opengl/util/glsl/ShaderState.java | 4 ++-- src/jogl/classes/javax/media/opengl/GLDrawableFactory.java | 2 +- src/jogl/classes/javax/media/opengl/GLPipelineFactory.java | 10 +++++----- src/jogl/classes/javax/media/opengl/GLUniformData.java | 12 ++++++------ 9 files changed, 27 insertions(+), 27 deletions(-) (limited to 'src/jogl/classes/com') diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg index 7cf51fda5..3df9cc852 100644 --- a/make/config/jogl/gl-common.cfg +++ b/make/config/jogl/gl-common.cfg @@ -611,7 +611,7 @@ ClassJavadoc GL3 * inclusive - forward compatible, as well as most of it's exte ClassJavadoc GL3 * time of this specification.
    ClassJavadoc GL3 * Note: OpenGL 3.0 forward compatible, non deprecated functionality is included in the ClassJavadoc GL3 * 3.1 specification, hence the {@link GL2GL3} implemented interface.
    -ClassJavadoc GL3 * Note: OpenGL 3.1 (forward compatible) no more includes fixed point functionality. +ClassJavadoc GL3 * Note: OpenGL 3.1 forward compatible no more includes fixed point functionality. ClassJavadoc GL3 *

    ClassJavadoc GL3 */ diff --git a/make/doc/jogl/spec-overview.html b/make/doc/jogl/spec-overview.html index 6557e9f7a..89b4ac7c8 100644 --- a/make/doc/jogl/spec-overview.html +++ b/make/doc/jogl/spec-overview.html @@ -67,7 +67,7 @@ inclusive - forward compatible only, as well as most of it's extensions defined time of this specification.
    Note: OpenGL 3.0 forward compatible, non deprecated functionality is included in the 3.1 specification, hence the {@link javax.media.opengl.GL2GL3} implemented interface.
    - Note: OpenGL 3.1 (forward compatible) no more includes fixed point functionality.
    + Note: OpenGL 3.1 forward compatible no more includes fixed point functionality.
    Future extensions will be added with a maintenance update
  • {@link javax.media.opengl.GLES1 javax.media.opengl.GLES1} interface
    diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java index de911950a..0d540647a 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java @@ -69,7 +69,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { /** * Returns the sole GLDrawableFactoryImpl instance. * - * @arg glProfile GLProfile to determine the factory type, ie EGLDrawableFactory, + * @param glProfile GLProfile to determine the factory type, ie EGLDrawableFactory, * or one of the native GLDrawableFactory's, ie X11/GLX, Windows/WGL or MacOSX/CGL. */ public static GLDrawableFactoryImpl getFactoryImpl(GLProfile glp) { diff --git a/src/jogl/classes/com/sun/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/sun/opengl/util/GLArrayDataClient.java index e05a77226..ec4c5e393 100644 --- a/src/jogl/classes/com/sun/opengl/util/GLArrayDataClient.java +++ b/src/jogl/classes/com/sun/opengl/util/GLArrayDataClient.java @@ -27,13 +27,13 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData }) != null; /** - * @arg index The GL array index - * @arg name The optional custom name for the GL array index, maybe null. + * @param index The GL array index + * @param name The optional custom name for the GL array index, maybe null. * If null, the default name mapping will be used, see 'getPredefinedArrayIndexName(int)'. * This name might be used as the shader attribute name. - * @arg comps The array component number - * @arg dataType The array index GL data type - * @arg normalized Wheather the data shall be normalized + * @param comps The array component number + * @param dataType The array index GL data type + * @param normalized Wheather the data shall be normalized * * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) */ diff --git a/src/jogl/classes/com/sun/opengl/util/GLArrayDataServer.java b/src/jogl/classes/com/sun/opengl/util/GLArrayDataServer.java index e9a5e2754..dc233ce36 100644 --- a/src/jogl/classes/com/sun/opengl/util/GLArrayDataServer.java +++ b/src/jogl/classes/com/sun/opengl/util/GLArrayDataServer.java @@ -21,13 +21,13 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * EnableVertexAttribArray and VertexAttribPointer calls, * and a predefined vertex attribute variable name will be choosen. * - * @arg index The GL array index - * @arg name The optional custom name for the GL array index, maybe null. + * @param index The GL array index + * @param name The optional custom name for the GL array index, maybe null. * If null, the default name mapping will be used, see 'getPredefinedArrayIndexName(int)'. * This name might be used as the shader attribute name. - * @arg comps The array component number - * @arg dataType The array index GL data type - * @arg normalized Wheather the data shall be normalized + * @param comps The array component number + * @param dataType The array index GL data type + * @param normalized Wheather the data shall be normalized * * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) */ diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderState.java b/src/jogl/classes/com/sun/opengl/util/glsl/ShaderState.java index d8f6eeea2..8712ac7e2 100644 --- a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderState.java +++ b/src/jogl/classes/com/sun/opengl/util/glsl/ShaderState.java @@ -318,7 +318,7 @@ public class ShaderState { * Even if the attribute is not found in the current shader, * it is stored in this state. * - * @arg data the GLArrayData's name must match the attributes one, + * @param data the GLArrayData's name must match the attributes one, * it's index will be set with the attribute's location, * if found. * @@ -549,7 +549,7 @@ public class ShaderState { * Even if the uniform is not found in the current shader, * it is stored in this state. * - * @arg data the GLUniforms's name must match the uniform one, + * @param data the GLUniforms's name must match the uniform one, * it's index will be set with the uniforms's location, * if found. * diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index 5a761119f..1a18a60f8 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -148,7 +148,7 @@ public abstract class GLDrawableFactory { /** * Returns the sole GLDrawableFactory instance. * - * @arg glProfile GLProfile to determine the factory type, ie EGLDrawableFactory, + * @param glProfile GLProfile to determine the factory type, ie EGLDrawableFactory, * or one of the native GLDrawableFactory's, ie X11/GLX, Windows/WGL or MacOSX/CGL. */ public static GLDrawableFactory getFactory(GLProfile glProfile) throws GLException { diff --git a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java index 9aceb2c53..63b50cb3c 100644 --- a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java @@ -54,7 +54,7 @@ public class GLPipelineFactory { * The upstream GL instance is determined as follows: *
      *
    • Use pipelineClazzBaseName as the class name's full basename, incl. package name
    • - *
    • For the downstream classe and it's superclasses, do:
    • + *
    • For the downstream class and it's superclasses, do:
    • *
        *
      • For all downstream class and superclass interfaces, do:
      • *
          @@ -65,10 +65,10 @@ public class GLPipelineFactory { *
        *

      * - * @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 + * @param pipelineClazzBaseName the basename of the pipline class name + * @param reqInterface optional requested interface to be used, may be null, in which case the first matching one is used + * @param downstream is always the 1st argument for the upstream constructor + * @param additionalArgs additional arguments for the upstream constructor */ public static final GL create(String pipelineClazzBaseName, Class reqInterface, GL downstream, Object[] additionalArgs) { Class downstreamClazz = downstream.getClass(); diff --git a/src/jogl/classes/javax/media/opengl/GLUniformData.java b/src/jogl/classes/javax/media/opengl/GLUniformData.java index 8b5fb1a03..f628ce35a 100644 --- a/src/jogl/classes/javax/media/opengl/GLUniformData.java +++ b/src/jogl/classes/javax/media/opengl/GLUniformData.java @@ -10,7 +10,7 @@ public class GLUniformData { * * Number of objects is 1 * - * @arg components number of elements of one object, ie 4 for GL_FLOAT_VEC4, + * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4, */ public GLUniformData(String name, int val) { init(name, 1, new Integer(val)); @@ -21,7 +21,7 @@ public class GLUniformData { * * Number of objects is 1 * - * @arg components number of elements of one object, ie 4 for GL_FLOAT_VEC4, + * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4, */ public GLUniformData(String name, float val) { init(name, 1, new Float(val)); @@ -32,7 +32,7 @@ public class GLUniformData { * * Number of objects is calculated by data.limit()/components * - * @arg components number of elements of one object, ie 4 for GL_FLOAT_VEC4, + * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4, */ public GLUniformData(String name, int components, IntBuffer data) { init(name, components, data); @@ -43,7 +43,7 @@ public class GLUniformData { * * Number of objects is calculated by data.limit()/components * - * @arg components number of elements of one object, ie 4 for GL_FLOAT_VEC4, + * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4, */ public GLUniformData(String name, int components, FloatBuffer data) { init(name, components, data); @@ -54,8 +54,8 @@ public class GLUniformData { * * Number of objects is calculated by data.limit()/(rows*columns) * - * @arg rows the matrix rows - * @arg column the matrix column + * @param rows the matrix rows + * @param column the matrix column */ public GLUniformData(String name, int rows, int columns, FloatBuffer data) { init(name, rows, columns, data); -- cgit v1.2.3 From bda9e3bc462e5489aa9bc168adda438864e89ed4 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 2 Aug 2009 14:00:51 -0700 Subject: Fix GLX/WGL GraphicsConfigurationFactory: Be more relaxed in error handling - keep going, even if underlying impl/modules cannot choose a config. Allows VBOX to run NEWT/JOGL --- .../WindowsWGLGraphicsConfigurationFactory.java | 13 ++++++++-- .../glx/X11GLXGraphicsConfigurationFactory.java | 29 +++++++++++++++++----- 2 files changed, 34 insertions(+), 8 deletions(-) (limited to 'src/jogl/classes/com') 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 98ad83313..a7d7be349 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 @@ -246,12 +246,21 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio try { pixelFormat = chooser.chooseCapabilities(capabilities, availableCaps, recommendedPixelFormat) + 1; } catch (NativeWindowException e) { - throw new GLException(e); + if(DEBUG) { + e.printStackTrace(); + } + pixelFormat = -1; } } else { pixelFormat = recommendedPixelFormat; } - if ((pixelFormat <= 0) || (pixelFormat > numFormats)) { + if (pixelFormat <= 0) { + // keep on going .. + if(DEBUG) { + System.err.println("WindowsWGLGraphicsConfigurationFactory.updateGraphicsConfiguration .. unable to choose config, using first"); + } + pixelFormat = 1; // default .. + } else if ( pixelFormat > numFormats ) { throw new GLException("Invalid result " + pixelFormat + " from GLCapabilitiesChooser (should be between 1 and " + numFormats + ")"); diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java index 9cb7eac08..49b56ea0e 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java @@ -215,11 +215,19 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac try { chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex); } catch (NativeWindowException e) { - throw new GLException(e); + if(DEBUG) { + e.printStackTrace(); + } + chosen = -1; } } - - if (chosen < 0 || chosen >= caps.length) { + if (chosen < 0) { + // keep on going .. + if(DEBUG) { + System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig .. unable to choose config, using first"); + } + chosen = 0; // default .. + } else if (chosen >= caps.length) { throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")"); } @@ -255,7 +263,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac GLCapabilities[] caps = null; int recommendedIndex = -1; XVisualInfo retXVisualInfo = null; - int chosen; + int chosen=-1; NativeWindowFactory.getDefaultFactory().getToolkitLock().lock(); try { @@ -293,9 +301,18 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac try { chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex); } catch (NativeWindowException e) { - throw new GLException(e); + if(DEBUG) { + e.printStackTrace(); + } + chosen = -1; } - if (chosen < 0 || chosen >= caps.length) { + if (chosen < 0) { + // keep on going .. + if(DEBUG) { + System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual .. unable to choose config, using first"); + } + chosen = 0; // default .. + } else if (chosen >= caps.length) { throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")"); } if (infos[chosen] == null) { -- cgit v1.2.3 From 33c4fbf49ff5d91925d3653dd5d5f034825954e7 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 3 Aug 2009 13:18:17 -0700 Subject: Doc: OpenGL 3.1 .. 3.2 profile clarification GLX_ARB_create_context: Add 3.2 context WGL_ARB_create_context: Add 3.2 context Add: Trying to use 3.2 core profile creation for GL3, disabled by default. (Disabled per default due to a freezing JVM on Linux _after_ the Java main thread and Hotspot finishes.) Experimental: You may try '3.2 core profile creation' setting the java system property 'jogl.GLContext.3_2'. --- make/doc/jogl/spec-overview.html | 3 +- make/stub_includes/opengl/GL/glxext.h | 7 +- make/stub_includes/opengl/GL/wglext.h | 7 +- .../classes/com/sun/opengl/impl/GLContextImpl.java | 1 + .../opengl/impl/windows/wgl/WindowsWGLContext.java | 81 ++++++++++++++-------- .../com/sun/opengl/impl/x11/glx/X11GLXContext.java | 76 ++++++++++++++------ 6 files changed, 120 insertions(+), 55 deletions(-) (limited to 'src/jogl/classes/com') diff --git a/make/doc/jogl/spec-overview.html b/make/doc/jogl/spec-overview.html index f2c0c0339..5d4779c57 100644 --- a/make/doc/jogl/spec-overview.html +++ b/make/doc/jogl/spec-overview.html @@ -329,12 +329,13 @@ according the following rules:
    • OpenGL 3.1 requires a new native context, incompatible with prior versions.
    • OpenGL 3.1 forward compatible profile drops fixed functionality.
  • -
  • Forward compatibility, dropping fixed functionality, is choosen because: +
  • Forward compatibility, aka core, ie a context without GL_ARB_compatibility, is chosen because:
    • It shares a commont subset with ES2.x
    • It is not guaranteed to be provided by all vendors.
    • It is not guaranteed to be provided in future versions.
    • OpenGL 3.2 core profile is compatible with OpenGL 3.1 forward compatible spec.
    • +
    • OpenGL 3.2 Spec Appendix E.1: It is not possible to implement both core and compatibility profiles in a single GL context, ..
  • diff --git a/make/stub_includes/opengl/GL/glxext.h b/make/stub_includes/opengl/GL/glxext.h index 2d6036bcd..2ed99a824 100644 --- a/make/stub_includes/opengl/GL/glxext.h +++ b/make/stub_includes/opengl/GL/glxext.h @@ -77,11 +77,14 @@ extern "C" { #endif #ifndef GLX_ARB_create_context -#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 -#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 +#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 +#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 +#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 #define GLX_CONTEXT_FLAGS_ARB 0x2094 +#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 #endif #ifndef GLX_SGIS_multisample diff --git a/make/stub_includes/opengl/GL/wglext.h b/make/stub_includes/opengl/GL/wglext.h index 6f367c09b..d581756c2 100644 --- a/make/stub_includes/opengl/GL/wglext.h +++ b/make/stub_includes/opengl/GL/wglext.h @@ -190,12 +190,15 @@ extern "C" { #endif #ifndef WGL_ARB_create_context +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 +#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 #define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 #define WGL_CONTEXT_FLAGS_ARB 0x2094 -#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 -#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 +#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 #define ERROR_INVALID_VERSION_ARB 0x2095 #endif diff --git a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java index 16eb934bd..d1a35b1b6 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java @@ -61,6 +61,7 @@ public abstract class GLContextImpl extends GLContext { // platforms anyway in particular with the disabling of the // GLWorkerThread which we found to be necessary in 1.0 beta 4. protected boolean optimizationEnabled = Debug.isPropertyDefined("jogl.GLContext.optimize", true); + protected boolean tryGLContext3_2 = Debug.isPropertyDefined("jogl.GLContext.3_2", true); // Cache of the functions that are available to be called at the current // moment in time 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 6d810ed39..008dd6ac2 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 @@ -154,13 +154,9 @@ public class WindowsWGLContext extends GLContextImpl { if( !isFunctionAvailable("wglCreateContextAttribsARB") || !isExtensionAvailable("WGL_ARB_create_context") ) { if(glCaps.getGLProfile().isGL3()) { - if (!WGL.wglMakeCurrent(0, 0)) { - throw new GLException("Error freeing temp OpenGL context: " + WGL.GetLastError()); - } - if (!WGL.wglDeleteContext(temp_hglrc)) { - throw new GLException("Unable to delete OpenGL context"); - } - throw new GLException("Unable to create OpenGL 3.1 context (no WGL_ARB_create_context)"); + WGL.wglMakeCurrent(0, 0); + WGL.wglDeleteContext(temp_hglrc); + throw new GLException("Unable to create OpenGL >= 3.1 context (no WGL_ARB_create_context)"); } // continue with temp context for GL < 3.0 @@ -173,44 +169,71 @@ public class WindowsWGLContext extends GLContextImpl { // preset with default values int attribs[] = { - WGLExt.WGL_CONTEXT_MAJOR_VERSION_ARB, 3, - WGLExt.WGL_CONTEXT_MINOR_VERSION_ARB, 0, - WGLExt.WGL_CONTEXT_FLAGS_ARB, 0, - 0 + /* 0 */ WGLExt.WGL_CONTEXT_MAJOR_VERSION_ARB, 3, + /* 2 */ WGLExt.WGL_CONTEXT_MINOR_VERSION_ARB, 0, + /* 4 */ WGLExt.WGL_CONTEXT_FLAGS_ARB, 0 /* WGLExt.WGL_CONTEXT_DEBUG_BIT_ARB */, + /* 6 */ 0, 0, + /* 8 */ 0 }; if(glCaps.getGLProfile().isGL3()) { - attribs[1] |= 3; - attribs[3] |= 1; - // attribs[5] |= WGLExt.WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB ; // NVidia WGL driver doesn't support this one .. - // attribs[5] |= WGLExt.WGL_CONTEXT_DEBUG_BIT_ARB ; + if(tryGLContext3_2) { + // Try >= 3.2 core first ! + // and verify with a None drawable binding (default framebuffer) + attribs[0+1] = 3; + attribs[2+1] = 2; + attribs[6+0] = WGLExt.WGL_CONTEXT_PROFILE_MASK_ARB; + attribs[6+1] = WGLExt.WGL_CONTEXT_CORE_PROFILE_BIT_ARB; + hglrc = wglExt.wglCreateContextAttribsARB(drawable.getNativeWindow().getSurfaceHandle(), hglrc2, attribs, 0); + if(0!=hglrc) { + if (!WGL.wglMakeCurrent(0, hglrc)) { + if(DEBUG) { + System.err.println("WindowsWGLContext.createContext couldn't make >= 3.2 core context current - fallback"); + } + WGL.wglMakeCurrent(0, 0); + WGL.wglDeleteContext(hglrc); + hglrc = 0; + } else if(DEBUG) { + System.err.println("WindowsWGLContext.createContext >= 3.2 available 0x"+Long.toHexString(hglrc)); + } + } + } + if(0==hglrc) { + if(tryGLContext3_2 && DEBUG) { + System.err.println("WindowsWGLContext.createContext couldn't create >= 3.2 core context"); + } + // Try >= 3.1 forward compatible - last resort for GL3 ! + attribs[0+1] = 3; + attribs[2+1] = 1; + attribs[4+1] |= WGLExt.WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; + attribs[6+0] = 0; + attribs[6+1] = 0; + } + } + if(0==hglrc) { + // 3.1 or 3.0 .. + hglrc = wglExt.wglCreateContextAttribsARB(drawable.getNativeWindow().getSurfaceHandle(), hglrc2, attribs, 0); } - hglrc = wglExt.wglCreateContextAttribsARB(drawable.getNativeWindow().getSurfaceHandle(), hglrc2, attribs, 0); if(0==hglrc) { if(glCaps.getGLProfile().isGL3()) { - if (!WGL.wglMakeCurrent(0, 0)) { - throw new GLException("Error freeing temp OpenGL context: " + WGL.GetLastError()); - } - if (!WGL.wglDeleteContext(temp_hglrc)) { - throw new GLException("Unable to delete OpenGL context"); - } - throw new GLException("Unable to create OpenGL 3.1 context (have WGL_ARB_create_context)"); + WGL.wglMakeCurrent(0, 0); + WGL.wglDeleteContext(temp_hglrc); + throw new GLException("Unable to create OpenGL >= 3.1 context (have WGL_ARB_create_context)"); } // continue with temp context for GL < 3.0 hglrc = temp_hglrc; + if (!WGL.wglMakeCurrent(drawable.getNativeWindow().getSurfaceHandle(), hglrc)) { + throw new GLException("Error making old context current: " + WGL.GetLastError()); + } if(DEBUG) { System.err.println("WindowsWGLContext.create done (old ctx < 3.0 - no 3.0) 0x"+Long.toHexString(hglrc)); } } else { hglrc2 = 0; // mark as shared .. - if (!WGL.wglMakeCurrent(0, 0)) { - throw new GLException("Error freeing temp OpenGL context: " + WGL.GetLastError()); - } - if (!WGL.wglDeleteContext(temp_hglrc)) { - throw new GLException("Unable to delete temp OpenGL context"); - } + WGL.wglMakeCurrent(0, 0); + WGL.wglDeleteContext(temp_hglrc); if (!WGL.wglMakeCurrent(drawable.getNativeWindow().getSurfaceHandle(), hglrc)) { throw new GLException("Error making new context current: " + WGL.GetLastError()); diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java index da1548d0d..6513fbe29 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java @@ -142,7 +142,7 @@ public abstract class X11GLXContext extends GLContextImpl { if(config.getFBConfigID()<0) { // not able to use FBConfig if(glCaps.getGLProfile().isGL3()) { - throw new GLException("Unable to create OpenGL 3.1 context"); + throw new GLException("Unable to create OpenGL >= 3.1 context"); } context = GLX.glXCreateContext(display, config.getXVisualInfo(), share, direct); if (context == 0) { @@ -178,11 +178,9 @@ public abstract class X11GLXContext extends GLContextImpl { if( !isFunctionAvailable("glXCreateContextAttribsARB") || !isExtensionAvailable("GLX_ARB_create_context") ) { if(glCaps.getGLProfile().isGL3()) { - if (!GLX.glXMakeContextCurrent(display, 0, 0, 0)) { - throw new GLException("Error freeing temp OpenGL context"); - } + GLX.glXMakeContextCurrent(display, 0, 0, 0); GLX.glXDestroyContext(display, temp_context); - throw new GLException("Unable to create OpenGL 3.1 context (no GLX_ARB_create_context)"); + throw new GLException("Unable to create OpenGL >= 3.1 context (no GLX_ARB_create_context)"); } // continue with temp context for GL < 3.0 @@ -195,38 +193,74 @@ public abstract class X11GLXContext extends GLContextImpl { // preset with default values int attribs[] = { - GLX.GLX_CONTEXT_MAJOR_VERSION_ARB, 3, - GLX.GLX_CONTEXT_MINOR_VERSION_ARB, 0, - GLX.GLX_CONTEXT_FLAGS_ARB, 0, - GLX.GLX_RENDER_TYPE, GLX.GLX_RGBA_TYPE, - 0 + /* 0 */ GLX.GLX_CONTEXT_MAJOR_VERSION_ARB, 3, + /* 2 */ GLX.GLX_CONTEXT_MINOR_VERSION_ARB, 0, + /* 4 */ GLX.GLX_RENDER_TYPE, GLX.GLX_RGBA_TYPE, + /* 6 */ GLX.GLX_CONTEXT_FLAGS_ARB, 0 /* GLX.GLX_CONTEXT_DEBUG_BIT_ARB */, + /* 8 */ 0, 0, + /* 10 */ 0 }; if(glCaps.getGLProfile().isGL3()) { - attribs[1] |= 3; - attribs[3] |= 1; - attribs[5] |= GLX.GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB /* | GLX.GLX_CONTEXT_DEBUG_BIT_ARB */; + if(tryGLContext3_2) { + // Try >= 3.2 core first + // and verify with a None drawable binding (default framebuffer) + attribs[0+1] = 3; + attribs[2+1] = 2; + attribs[8+0] = GLX.GLX_CONTEXT_PROFILE_MASK_ARB; + attribs[8+1] = GLX.GLX_CONTEXT_CORE_PROFILE_BIT_ARB; + + context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0); + if(0!=context) { + if (!GLX.glXMakeContextCurrent(display, 0, 0, context)) { + if(DEBUG) { + System.err.println("X11GLXContext.createContext couldn't make >= 3.2 core context current - fallback"); + } + GLX.glXMakeContextCurrent(display, 0, 0, 0); + GLX.glXDestroyContext(display, context); + context = 0; + } else if(DEBUG) { + System.err.println("X11GLXContext.createContext >= 3.2 available 0x"+Long.toHexString(context)); + } + } + } + if(0==context) { + if(tryGLContext3_2 && DEBUG) { + System.err.println("X11GLXContext.createContext couldn't create >= 3.2 core context - fallback"); + } + // Try >= 3.1 forward compatible - last resort for GL3 ! + attribs[0+1] = 3; + attribs[2+1] = 1; + attribs[6+1] |= GLX.GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; + attribs[8+0] = 0; + attribs[8+1] = 0; + } + } + if(0==context) { + // 3.1 or 3.0 .. + context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0); } - context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0); if(0==context) { if(glCaps.getGLProfile().isGL3()) { - if (!GLX.glXMakeContextCurrent(display, 0, 0, 0)) { - throw new GLException("Error freeing temp OpenGL context"); - } + GLX.glXMakeContextCurrent(display, 0, 0, 0); GLX.glXDestroyContext(display, temp_context); - throw new GLException("Unable to create OpenGL 3.1 context (have GLX_ARB_create_context)"); + throw new GLException("Unable to create OpenGL >= 3.1 context (have GLX_ARB_create_context)"); } // continue with temp context for GL < 3.0 context = temp_context; + if (!GLX.glXMakeContextCurrent(display, + drawable.getNativeWindow().getSurfaceHandle(), + drawable.getNativeWindow().getSurfaceHandle(), + context)) { + throw new GLException("Error making context (old) current: display 0x"+Long.toHexString(display)+", context 0x"+Long.toHexString(context)+", drawable "+drawable); + } if(DEBUG) { System.err.println("X11GLXContext.createContext done (old ctx < 3.0 - no 3.0) 0x"+Long.toHexString(context)); } } else { - if (!GLX.glXMakeContextCurrent(display, 0, 0, 0)) { - throw new GLException("Error freeing temp OpenGL context"); - } + GLX.glXMakeContextCurrent(display, 0, 0, 0); GLX.glXDestroyContext(display, temp_context); // need to update the GL func table .. -- cgit v1.2.3 From d741053ed1a422b75d6aeac28be7c5cdba4c4564 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 3 Aug 2009 14:51:57 -0700 Subject: WGL 3.2: No need for 'jogl.GLContext.3_2' - just works. --- .../opengl/impl/windows/wgl/WindowsWGLContext.java | 48 ++++++++-------------- .../com/sun/opengl/impl/x11/glx/X11GLXContext.java | 9 ++-- 2 files changed, 22 insertions(+), 35 deletions(-) (limited to 'src/jogl/classes/com') 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 008dd6ac2..e459d0c5a 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 @@ -147,7 +147,7 @@ public class WindowsWGLContext extends GLContextImpl { throw new GLException("Unable to create temp OpenGL context for device context " + toHexString(drawable.getNativeWindow().getSurfaceHandle())); } else { if (!WGL.wglMakeCurrent(drawable.getNativeWindow().getSurfaceHandle(), temp_hglrc)) { - throw new GLException("Error making temp context current: " + WGL.GetLastError()); + throw new GLException("Error making temp context current: 0x" + Integer.toHexString(WGL.GetLastError())); } setGLFunctionAvailability(true); @@ -177,30 +177,16 @@ public class WindowsWGLContext extends GLContextImpl { }; if(glCaps.getGLProfile().isGL3()) { - if(tryGLContext3_2) { - // Try >= 3.2 core first ! - // and verify with a None drawable binding (default framebuffer) - attribs[0+1] = 3; - attribs[2+1] = 2; - attribs[6+0] = WGLExt.WGL_CONTEXT_PROFILE_MASK_ARB; - attribs[6+1] = WGLExt.WGL_CONTEXT_CORE_PROFILE_BIT_ARB; - hglrc = wglExt.wglCreateContextAttribsARB(drawable.getNativeWindow().getSurfaceHandle(), hglrc2, attribs, 0); - if(0!=hglrc) { - if (!WGL.wglMakeCurrent(0, hglrc)) { - if(DEBUG) { - System.err.println("WindowsWGLContext.createContext couldn't make >= 3.2 core context current - fallback"); - } - WGL.wglMakeCurrent(0, 0); - WGL.wglDeleteContext(hglrc); - hglrc = 0; - } else if(DEBUG) { - System.err.println("WindowsWGLContext.createContext >= 3.2 available 0x"+Long.toHexString(hglrc)); - } - } - } + // Try >= 3.2 core first ! + // In contrast to GLX no verify with a None drawable binding (default framebuffer) is necessary. + attribs[0+1] = 3; + attribs[2+1] = 2; + attribs[6+0] = WGLExt.WGL_CONTEXT_PROFILE_MASK_ARB; + attribs[6+1] = WGLExt.WGL_CONTEXT_CORE_PROFILE_BIT_ARB; + hglrc = wglExt.wglCreateContextAttribsARB(drawable.getNativeWindow().getSurfaceHandle(), hglrc2, attribs, 0); if(0==hglrc) { - if(tryGLContext3_2 && DEBUG) { - System.err.println("WindowsWGLContext.createContext couldn't create >= 3.2 core context"); + if(DEBUG) { + System.err.println("WindowsWGLContext.createContext couldn't create >= 3.2 core context"); } // Try >= 3.1 forward compatible - last resort for GL3 ! attribs[0+1] = 3; @@ -208,6 +194,8 @@ public class WindowsWGLContext extends GLContextImpl { attribs[4+1] |= WGLExt.WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; attribs[6+0] = 0; attribs[6+1] = 0; + } else if(DEBUG) { + System.err.println("WindowsWGLContext.createContext >= 3.2 available 0x"+Long.toHexString(hglrc)); } } if(0==hglrc) { @@ -225,7 +213,7 @@ public class WindowsWGLContext extends GLContextImpl { // continue with temp context for GL < 3.0 hglrc = temp_hglrc; if (!WGL.wglMakeCurrent(drawable.getNativeWindow().getSurfaceHandle(), hglrc)) { - throw new GLException("Error making old context current: " + WGL.GetLastError()); + throw new GLException("Error making old context current: 0x" + Integer.toHexString(WGL.GetLastError())); } if(DEBUG) { System.err.println("WindowsWGLContext.create done (old ctx < 3.0 - no 3.0) 0x"+Long.toHexString(hglrc)); @@ -236,7 +224,7 @@ public class WindowsWGLContext extends GLContextImpl { WGL.wglDeleteContext(temp_hglrc); if (!WGL.wglMakeCurrent(drawable.getNativeWindow().getSurfaceHandle(), hglrc)) { - throw new GLException("Error making new context current: " + WGL.GetLastError()); + throw new GLException("Error making new context current: 0x" + Integer.toHexString(WGL.GetLastError())); } updateGLProcAddressTable(); if(DEBUG) { @@ -248,8 +236,8 @@ public class WindowsWGLContext extends GLContextImpl { if(0!=hglrc2) { if (!WGL.wglShareLists(hglrc2, hglrc)) { throw new GLException("wglShareLists(" + toHexString(hglrc2) + - ", " + toHexString(hglrc) + ") failed: error code " + - WGL.GetLastError()); + ", " + toHexString(hglrc) + ") failed: error code 0x" + + Integer.toHexString(WGL.GetLastError())); } } GLContextShareSet.contextCreated(this); @@ -276,7 +264,7 @@ public class WindowsWGLContext extends GLContextImpl { if (WGL.wglGetCurrentContext() != hglrc) { if (!WGL.wglMakeCurrent(drawable.getNativeWindow().getSurfaceHandle(), hglrc)) { - throw new GLException("Error making context current: " + WGL.GetLastError()); + throw new GLException("Error making context current: 0x" + Integer.toHexString(WGL.GetLastError())); } else { if (DEBUG && VERBOSE) { System.err.println(getThreadName() + ": wglMakeCurrent(hdc " + toHexString(drawable.getNativeWindow().getSurfaceHandle()) + @@ -299,7 +287,7 @@ public class WindowsWGLContext extends GLContextImpl { protected void releaseImpl() throws GLException { if (!WGL.wglMakeCurrent(0, 0)) { - throw new GLException("Error freeing OpenGL context: " + WGL.GetLastError()); + throw new GLException("Error freeing OpenGL context: 0x" + Integer.toHexString(WGL.GetLastError())); } } diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java index 6513fbe29..126062d27 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java @@ -207,8 +207,8 @@ public abstract class X11GLXContext extends GLContextImpl { // and verify with a None drawable binding (default framebuffer) attribs[0+1] = 3; attribs[2+1] = 2; - attribs[8+0] = GLX.GLX_CONTEXT_PROFILE_MASK_ARB; - attribs[8+1] = GLX.GLX_CONTEXT_CORE_PROFILE_BIT_ARB; + // FIXME: attribs[8+0] = GLX.GLX_CONTEXT_PROFILE_MASK_ARB; + // FIXME: attribs[8+1] = GLX.GLX_CONTEXT_CORE_PROFILE_BIT_ARB; context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0); if(0!=context) { @@ -222,12 +222,11 @@ public abstract class X11GLXContext extends GLContextImpl { } else if(DEBUG) { System.err.println("X11GLXContext.createContext >= 3.2 available 0x"+Long.toHexString(context)); } + } else if(DEBUG) { + System.err.println("X11GLXContext.createContext couldn't create >= 3.2 core context - fallback"); } } if(0==context) { - if(tryGLContext3_2 && DEBUG) { - System.err.println("X11GLXContext.createContext couldn't create >= 3.2 core context - fallback"); - } // Try >= 3.1 forward compatible - last resort for GL3 ! attribs[0+1] = 3; attribs[2+1] = 1; -- cgit v1.2.3 From 0e998e8416b38b084b517c299061856b7ff963d7 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 5 Aug 2009 11:55:14 -0700 Subject: Update GlueGen to 7dc9c5601d5689dcbc003ca51cfe826942ea3e6b (latest) - Fixes for OpenGL 3.2 - More strict define/function checking - Better documentation in source code: extension relation - GL extension marker exclusion is done by GlueGen now - Adapted gluegen cfg files Added OpenGL 3.2 extensions for GL3 Revalidation of all OpenGL 2.0/3.0/3.1 and 3.2 extensions GL2GL3 based on OpenGL 2.0/3.0 headers EGL shares common egl-common.cfg file Removed experimental java system property 'jogl.GLContext.3_2', try a 3.2 context in case of GL3. X11GLXContext: - Always try to make a created context current, to verify it's usability. This is different than under WGL. - Temporary removed usage: GLX.GLX_CONTEXT_PROFILE_MASK_ARB NV driver bug. --- make/build-jogl.xml | 6 +- make/config/jogl/cgl-macosx.cfg | 4 +- make/config/jogl/cglext.cfg | 4 +- make/config/jogl/egl-common.cfg | 46 +++ make/config/jogl/egl.cfg | 22 +- make/config/jogl/eglext.cfg | 82 +----- make/config/jogl/gl-common-extensions.cfg | 10 +- make/config/jogl/gl-common-gl2.cfg | 8 - make/config/jogl/gl-common.cfg | 101 +++---- make/config/jogl/gl-desktop.cfg | 3 + make/config/jogl/gl-gl2-set.cfg | 13 - make/config/jogl/gl-gl2.cfg | 2 +- make/config/jogl/gl-gl2es12.cfg | 2 +- make/config/jogl/gl-gl3-set.cfg | 14 + make/config/jogl/gl-gl3.cfg | 14 +- make/config/jogl/gl-if-CustomJavaCode-gl2.java | 21 -- make/config/jogl/gl-if-CustomJavaCode-gl3.java | 8 + make/config/jogl/gl-if-gl2_gl3.cfg | 20 +- make/config/jogl/gl-impl-CustomJavaCode-gles1.java | 2 +- make/config/jogl/gl-impl-CustomJavaCode-gles2.java | 2 +- make/config/jogl/gl3-common.cfg | 24 ++ make/config/jogl/gl3-desktop.cfg | 1 - make/config/jogl/glu-common.cfg | 2 + make/config/jogl/glx-x11.cfg | 5 +- make/config/jogl/glxext.cfg | 5 +- make/config/jogl/wgl-win32.cfg | 7 +- make/config/jogl/wglext.cfg | 7 +- make/stub_includes/egl/EGL/egl.h | 7 + make/stub_includes/egl/EGL/eglext.h | 58 ++-- make/stub_includes/opengl/GL/glext.h | 74 ++--- make/stub_includes/opengl/GL/glu.h | 19 +- make/stub_includes/opengl/GL/glx.h | 10 +- make/stub_includes/opengl/GL/glxext.h | 11 +- make/stub_includes/opengl/GL3/gl3.h | 4 +- make/stub_includes/opengl/GL3/gl3ext.h | 309 ++++++++++++++++++++- make/stub_includes/opengl/GLES/gl.h | 10 + make/stub_includes/opengl/GLES/glext.h | 2 - make/stub_includes/opengl/GLES2/gl2.h | 8 +- make/stub_includes/opengl/GLES2/gl2ext.h | 11 +- make/stub_includes/opengl/gl2es12.c | 5 - make/stub_includes/opengl/gl3-64bit-types.h | 41 +++ make/stub_includes/opengl/glu-impl.c | 3 - make/stub_includes/win32/wingdi.h | 9 + .../classes/com/sun/opengl/impl/GLContextImpl.java | 1 - .../impl/macosx/cgl/MacOSXPbufferCGLContext.java | 2 +- .../impl/macosx/cgl/MacOSXPbufferCGLDrawable.java | 2 +- .../opengl/impl/windows/wgl/WindowsWGLContext.java | 12 +- .../com/sun/opengl/impl/x11/glx/X11GLXContext.java | 69 +++-- 48 files changed, 748 insertions(+), 354 deletions(-) create mode 100644 make/config/jogl/egl-common.cfg delete mode 100644 make/config/jogl/gl-common-gl2.cfg delete mode 100644 make/config/jogl/gl-gl2-set.cfg create mode 100644 make/config/jogl/gl-gl3-set.cfg create mode 100644 make/config/jogl/gl-if-CustomJavaCode-gl3.java create mode 100644 make/config/jogl/gl3-common.cfg create mode 100644 make/stub_includes/opengl/gl3-64bit-types.h delete mode 100644 make/stub_includes/opengl/glu-impl.c (limited to 'src/jogl/classes/com') diff --git a/make/build-jogl.xml b/make/build-jogl.xml index e5bb1ab38..846779fed 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -640,14 +640,14 @@ - - Include ../intptr.cfg diff --git a/make/config/jogl/eglext.cfg b/make/config/jogl/eglext.cfg index 857eb5804..fedff35e9 100755 --- a/make/config/jogl/eglext.cfg +++ b/make/config/jogl/eglext.cfg @@ -9,54 +9,17 @@ JavaClass EGLExt ImplPackage com.sun.opengl.impl.egl ImplJavaClass EGLExtImpl # Shouldn't matter which one of these we pick up +Include egl-common.cfg ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/sun/opengl/impl/egl/EGL.java + HierarchicalNativeOutput false -Include gl-common.cfg # Use a ProcAddressTable so we dynamically look up the routines EmitProcAddressTable true ProcAddressTableClassName EGLExtProcAddressTable GetProcAddressTableExpr _context.getEGLExtProcAddressTable() -# Translate EGLBoolean as Java boolean -Opaque boolean EGLBoolean - -# Implement the first argument to eglGetProcAddress as String instead -# of byte[] -ArgumentIsString eglGetProcAddress 0 -ReturnsString eglQueryString - -# Make eglGetProcAddress return an opaque long -Opaque long __EGLFuncPtr - -# Force all of the methods to be emitted using dynamic linking so we -# don't need to link against any emulation library on the desktop or -# depend on the presence of an import library for a particular device -ForceProcAddressGen __ALL__ - -# Also force the calling conventions of the locally generated function -# pointer typedefs for these routines to EGLAPIENTRY -LocalProcAddressCallingConvention __ALL__ EGLAPIENTRY - -# Treat all of the EGL types as opaque longs -# Opaque long EGLConfig -Opaque long EGLContext -Opaque long EGLDisplay -Opaque long EGLSurface -Opaque long EGLNativeDisplayType -Opaque long EGLNativeWindowType -Opaque long EGLNativePixmapType -Opaque long EGLClientBuffer -Opaque long EGLImageKHR -#Opaque long EGLPerfMonitorNV -#Opaque long EGLPerfCounterNV -#Opaque long EGLPerfMarkerNV -Opaque long EGLSyncKHR -Opaque long NativeSyncKHR - -# Opaque long EGLClientBuffer - CustomCCode /* Define EGL_EGLEXT_PROTOTYPES so that the EGL extension prototypes in CustomCCode "eglext.h" are parsed. */ CustomCCode #define EGL_EGLEXT_PROTOTYPES @@ -66,9 +29,14 @@ CustomCCode #include Include ../intptr.cfg # There are some #defines in eglext.h that GlueGen and PCPP don't currently handle +CustomJavaCode EGLExt /** Part of EGL_KHR_image */ CustomJavaCode EGLExt public static final long EGL_NO_IMAGE = 0; +CustomJavaCode EGLExt /** Part of EGL_NV_perfmon */ CustomJavaCode EGLExt public static final long EGL_NO_PERFMONITOR = 0; +CustomJavaCode EGLExt /** Part of EGL_NV_perfmon */ CustomJavaCode EGLExt public static final long EGL_DEFAULT_PERFMARKER = 0; +CustomJavaCode EGLExt /** Part of EGL_KHR_sync */ +CustomJavaCode EGLExt public static final long EGL_FOREVER_KHR = 0xFFFFFFFFFFFFFFFFL ; CustomJavaCode EGLExt public boolean isFunctionAvailable(String glFunctionName); CustomJavaCode EGLExt public boolean isExtensionAvailable(String glExtensionName); @@ -88,39 +56,3 @@ CustomJavaCode EGLExtImpl } CustomJavaCode EGLExtImpl private EGLContext _context; -# These Ignores cause the core EGL routines to be ignored from the -# EGLExt interface and EGLExtImpl implementing class. -Ignore eglBindAPI -Ignore eglBindTexImage -Ignore eglChooseConfig -Ignore eglCopyBuffers -Ignore eglCreateContext -Ignore eglCreatePbufferFromClientBuffer -Ignore eglCreatePbufferSurface -Ignore eglCreatePixmapSurface -Ignore eglCreateWindowSurface -Ignore eglDestroyContext -Ignore eglDestroySurface -Ignore eglGetConfigAttrib -Ignore eglGetConfigs -Ignore eglGetCurrentContext -Ignore eglGetCurrentDisplay -Ignore eglGetCurrentSurface -Ignore eglGetDisplay -Ignore eglGetError -Ignore eglGetProcAddress -Ignore eglInitialize -Ignore eglMakeCurrent -Ignore eglQueryAPI -Ignore eglQueryContext -Ignore eglQueryString -Ignore eglQuerySurface -Ignore eglReleaseTexImage -Ignore eglReleaseThread -Ignore eglSurfaceAttrib -Ignore eglSwapBuffers -Ignore eglSwapInterval -Ignore eglTerminate -Ignore eglWaitClient -Ignore eglWaitGL -Ignore eglWaitNative diff --git a/make/config/jogl/gl-common-extensions.cfg b/make/config/jogl/gl-common-extensions.cfg index fb46e43ca..e28ff43c8 100644 --- a/make/config/jogl/gl-common-extensions.cfg +++ b/make/config/jogl/gl-common-extensions.cfg @@ -1,8 +1,8 @@ -# Note: we keep the Apple, ATI and NVidia extensions since they are generally +# Note: we keep the Apple, AMD/ATI and NVidia extensions since they are generally # the most useful and up-to-date DropUniqVendorExtensions 3DFX -DropUniqVendorExtensions AMD +# DropUniqVendorExtensions AMD # DropUniqVendorExtensions APPLE # DropUniqVendorExtensions ATI DropUniqVendorExtensions HP @@ -51,11 +51,6 @@ IgnoreExtension GL_NV_present_video IgnoreExtension GL_NV_coverage_sample IgnoreExtension GL_NV_framebuffer_vertex_attrib_array -# Remove extension suffixes from extensions which are common -RenameExtensionIntoCore GL_ARB_framebuffer_object -IgnoreExtension GL_EXT_framebuffer_object -RenameExtensionIntoCore GL_OES_framebuffer_object - # Remove extension suffixes from extensions which are common between OpenGL and OpenGL ES RenameExtensionIntoCore GL_ARB_half_float_pixel RenameExtensionIntoCore GL_ARB_point_sprite @@ -65,6 +60,7 @@ RenameExtensionIntoCore GL_OES_blend_subtract RenameExtensionIntoCore GL_OES_compressed_paletted_texture RenameExtensionIntoCore GL_OES_depth24 RenameExtensionIntoCore GL_OES_depth32 +RenameExtensionIntoCore GL_OES_framebuffer_object RenameExtensionIntoCore GL_OES_mapbuffer RenameExtensionIntoCore GL_OES_point_sprite RenameExtensionIntoCore GL_OES_rgb8_rgba8 diff --git a/make/config/jogl/gl-common-gl2.cfg b/make/config/jogl/gl-common-gl2.cfg deleted file mode 100644 index 4d86d74cd..000000000 --- a/make/config/jogl/gl-common-gl2.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# This .cfg file provides common options used among all GL glue code -# generated for Jogl on Windows. - -HierarchicalNativeOutput false -Include gl-common.cfg - -# XID needs to be treated as a long for 32/64 bit compatibility -Opaque long XID diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg index efa4c7bdd..4d3a05d63 100644 --- a/make/config/jogl/gl-common.cfg +++ b/make/config/jogl/gl-common.cfg @@ -1,6 +1,8 @@ # This .cfg file provides common options used among all glue code # generated for Jogl on all platforms. +HierarchicalNativeOutput false + # Raise GLException instead of RuntimeException in glue code RuntimeExceptionType GLException UnsupportedExceptionType GLException @@ -38,7 +40,6 @@ Ignore glTracePointerRangeMESA # Manually implement glMapBuffer as the size of the returned buffer # can only be computed by calling another routine ManuallyImplement glMapBuffer -ManuallyImplement glMapBufferOES # Ignore the ATI_map_object_buffer extension for now unless someone # claims they need it, as it will undoubtedly require a similar @@ -49,36 +50,6 @@ Ignore glUnmapObjectBufferATI # Ignore some GL functions that have outgoing void** parameters; we cannot yet deal with them Ignore glGetVariantPointervEXT -# Don't output #defines of GL name strings as constants, because we -# don't need them java-side. -# Format of name strings is found at: -# http://oss.sgi.com/projects/ogl-sample/registry/doc/template.txt - -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_EXT_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_ARB_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_OES_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_PGI_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_SGI_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_SGIS_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_SGIX_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_MESA_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_HP_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_ATI_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_NV_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_IBM_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_WIN_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_REND_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_APPLE_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_INTEL_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_INGR_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_SUN_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_SUNX_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_3DFX_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_OML_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_I3D_.+ -Ignore (GL|GLU|GLX|WGL|AGL|CGL)_S3_.+ -Ignore GL_KTX_buffer_region - # FIXME: these extensions require either a handle to a device context # or take void** parameters or both. Until we think through the # semantics of each of these individually we need to disable them. @@ -234,47 +205,79 @@ IgnoreExtension GL_EXT_texture_sRGB # <<< OpenGL 2.1 # >>> OpenGL 3.0 -# Ignore extensions subsumed in OpenGL 3.0 (from OpenGL 3.0 spec, Appendix N) -IgnoreExtension GL_EXT_gpu_shader4 +# Ignore/Rename extensions subsumed in OpenGL 3.0 (from OpenGL 3.0 spec, Appendix N) +RenameExtensionIntoCore GL_EXT_gpu_shader4 -IgnoreExtension GL_NV_conditional_render +RenameExtensionIntoCore GL_NV_conditional_render -#Not promoted in header files: GL_APPLE_flush_buffer_range +RenameExtensionIntoCore GL_APPLE_flush_buffer_range -IgnoreExtension GL_ARB_color_buffer_float -#Not promoted in header files: GL_NV_depth_buffer_float -IgnoreExtension GL_ARB_texture_float -IgnoreExtension GL_EXT_packed_float -IgnoreExtension GL_EXT_texture_shared_exponent +RenameExtensionIntoCore GL_ARB_color_buffer_float +# gl.h uses GL_ARB_depth_buffer_float +RenameExtensionIntoCore GL_ARB_depth_buffer_float +IgnoreExtension GL_NV_depth_buffer_float +RenameExtensionIntoCore GL_ARB_texture_float +RenameExtensionIntoCore GL_EXT_packed_float +RenameExtensionIntoCore GL_EXT_texture_shared_exponent +# gl.h uses GL_ARB_framebuffer_object +# GL_*_geometry_shader4 is included here, due to a naming collision otherwise. +# glFramebufferTextureLayerARB is ignored due to it's existence in GL_ARB_framebuffer_object and GL_ARB_geometry_shader4 +RenameExtensionIntoCore GL_ARB_framebuffer_object IgnoreExtension GL_EXT_framebuffer_object +RenameExtensionIntoCore GL_ARB_geometry_shader4 +IgnoreExtension GL_EXT_geometry_shader4 +Ignore glFramebufferTextureLayerARB -# GL_NV_half_float, GL_NV_half_float_pixel: these are also not usable for Java .. -IgnoreExtension GL_NV_half_float -IgnoreExtension GL_NV_half_float_pixel +RenameExtensionIntoCore GL_NV_half_float +RenameExtensionIntoCore GL_ARB_half_float_pixel -IgnoreExtension GL_EXT_framebuffer_multisample -IgnoreExtension GL_EXT_framebuffer_blit +RenameExtensionIntoCore GL_EXT_framebuffer_multisample +RenameExtensionIntoCore GL_EXT_framebuffer_blit #Big gap of promoted tokens and functions: GL_EXT_texture_integer +RenameExtensionIntoCore GL_EXT_texture_integer -IgnoreExtension GL_EXT_texture_array +RenameExtensionIntoCore GL_EXT_texture_array -IgnoreExtension GL_EXT_packed_depth_stencil +RenameExtensionIntoCore GL_EXT_packed_depth_stencil -#Not promoted in header files: GL_EXT_draw_buffers2 +RenameExtensionIntoCore GL_EXT_draw_buffers2 +# gl.h uses GL_ARB_texture_compression_rgtc +RenameExtensionIntoCore GL_ARB_texture_compression_rgtc IgnoreExtension GL_EXT_texture_compression_rgtc -IgnoreExtension GL_EXT_transform_feedback +RenameExtensionIntoCore GL_EXT_transform_feedback IgnoreExtension GL_NV_transform_feedback +# gl.h uses GL_ARB_vertex_array_object +RenameExtensionIntoCore GL_ARB_vertex_array_object IgnoreExtension GL_APPLE_vertex_array_object +# gl.h uses GL_ARB_framebuffer_sRGB +RenameExtensionIntoCore GL_ARB_framebuffer_sRGB IgnoreExtension GL_EXT_framebuffer_sRGB +RenameExtensionIntoCore GL_ARB_map_buffer_range + # <<< OpenGL 3.0 +# >>> OpenGL 3.1 +# Rename extension suffices (if exist) subsumed in OpenGL 3.1 (from OpenGL 3.1 spec, Appendix G.1) +# We alias 3.1 subsumed extension even for GL2, due to the convenience of the common GL2GL3 profile! +RenameExtensionIntoCore GL_ARB_draw_instanced +IgnoreExtension GL_EXT_draw_instanced +RenameExtensionIntoCore GL_ARB_copy_buffer +RenameExtensionIntoCore GL_NV_primitive_restart +RenameExtensionIntoCore GL_ARB_texture_buffer_object +IgnoreExtension GL_EXT_texture_buffer_object +# Actually GL_ARB_texture_rectangle, but let's be convenient +RenameExtensionIntoCore GL_EXT_texture_rectangle +IgnoreExtension GL_NV_texture_rectangle +RenameExtensionIntoCore GL_ARB_uniform_buffer_object +# <<< OpenGL 3.1 + # Ignore a few obsolete versions of extensions that have been subsumed into the core or ARB extensions diff --git a/make/config/jogl/gl-desktop.cfg b/make/config/jogl/gl-desktop.cfg index d6a610c59..7e500a4f0 100755 --- a/make/config/jogl/gl-desktop.cfg +++ b/make/config/jogl/gl-desktop.cfg @@ -26,6 +26,9 @@ Opaque boolean BOOL Opaque long PROC Opaque long void ** +# XID needs to be treated as a long for 32/64 bit compatibility +Opaque long XID + # # Directives needed when processing cglext.h on MacOSX and other platforms # diff --git a/make/config/jogl/gl-gl2-set.cfg b/make/config/jogl/gl-gl2-set.cfg deleted file mode 100644 index bce9cc731..000000000 --- a/make/config/jogl/gl-gl2-set.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# 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 7b689093a..50574598a 100644 --- a/make/config/jogl/gl-gl2.cfg +++ b/make/config/jogl/gl-gl2.cfg @@ -26,7 +26,7 @@ Implements GL2Impl GL Implements GL2Impl GL2ES1 Implements GL2Impl GL2ES2 Implements GL2Impl GL2GL3 -Include gl-common-gl2.cfg +Include gl-common.cfg Include gl-common-extensions.cfg Include gl-desktop.cfg diff --git a/make/config/jogl/gl-gl2es12.cfg b/make/config/jogl/gl-gl2es12.cfg index 36bab82ed..9e36da2ea 100644 --- a/make/config/jogl/gl-gl2es12.cfg +++ b/make/config/jogl/gl-gl2es12.cfg @@ -18,7 +18,7 @@ Implements GL2ES12Impl GL Implements GL2ES12Impl GL2ES1 Implements GL2ES12Impl GL2ES2 -Include gl-common-gl2.cfg +Include gl-common.cfg Include gl-common-extensions.cfg Include gl-desktop.cfg diff --git a/make/config/jogl/gl-gl3-set.cfg b/make/config/jogl/gl-gl3-set.cfg new file mode 100644 index 000000000..ac1edac47 --- /dev/null +++ b/make/config/jogl/gl-gl3-set.cfg @@ -0,0 +1,14 @@ +# 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 GL3Set +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl3-common.cfg +Include gl3-desktop.cfg + +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff diff --git a/make/config/jogl/gl-gl3.cfg b/make/config/jogl/gl-gl3.cfg index c5354cba4..576cd7cad 100644 --- a/make/config/jogl/gl-gl3.cfg +++ b/make/config/jogl/gl-gl3.cfg @@ -20,14 +20,26 @@ Implements GL3Impl GLBase Implements GL3Impl GL Implements GL3Impl GL2ES2 Implements GL3Impl GL2GL3 -Include gl-common-gl2.cfg +Include gl-common.cfg Include gl-common-extensions.cfg +Include gl3-common.cfg Include gl3-desktop.cfg +IncludeAs CustomJavaCode GL3 gl-if-CustomJavaCode-gl3.java + EmitProcAddressTable true ProcAddressTableClassName GL3ProcAddressTable GetProcAddressTableExpr ((GL3ProcAddressTable)_context.getGLProcAddressTable()) +# Force all of the methods to be emitted using dynamic linking so we +# don't need to link against any emulation library on the desktop or +# depend on the presence of an import library for a particular device +ForceProcAddressGen __ALL__ + +# Also force the calling conventions of the locally generated function +# pointer typedefs for these routines to APIENTRY +LocalProcAddressCallingConvention __ALL__ APIENTRY + # Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums TagNativeBinding true diff --git a/make/config/jogl/gl-if-CustomJavaCode-gl2.java b/make/config/jogl/gl-if-CustomJavaCode-gl2.java index fe6388cbe..4d1d0e048 100644 --- a/make/config/jogl/gl-if-CustomJavaCode-gl2.java +++ b/make/config/jogl/gl-if-CustomJavaCode-gl2.java @@ -10,30 +10,9 @@ public static final int GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT = 0x8DD8; /** Missed in the GL_EXT_gpu_shader4 promotion to 3.0 core */ public static final int GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT = 0x88FD; -/** Missed in the GL_ARB_color_buffer_float promotion to 3.0 core */ -public static final int GL_RGBA_FLOAT_MODE_ARB = 0x8820; - -/** Missed in the GL_ARB_texture_float promotion to 3.0 core */ -public static final int GL_ALPHA32F_ARB = 0x8816; -/** Missed in the GL_ARB_texture_float promotion to 3.0 core */ -public static final int GL_INTENSITY32F_ARB = 0x8817; -/** Missed in the GL_ARB_texture_float promotion to 3.0 core */ -public static final int GL_LUMINANCE32F_ARB = 0x8818; -/** Missed in the GL_ARB_texture_float promotion to 3.0 core */ -public static final int GL_ALPHA16F_ARB = 0x881C; -/** Missed in the GL_ARB_texture_float promotion to 3.0 core */ -public static final int GL_INTENSITY16F_ARB = 0x881D; -/** Missed in the GL_ARB_texture_float promotion to 3.0 core */ -public static final int GL_LUMINANCE16F_ARB = 0x881E; -/** Missed in the GL_ARB_texture_float promotion to 3.0 core */ -public static final int GL_LUMINANCE_ALPHA16F_ARB = 0x881F; - /** Missed in the GL_EXT_packed_float promotion to 3.0 core */ public static final int GL_RGBA_SIGNED_COMPONENTS_EXT = 0x8C3C; -/** Missed in the GL_EXT_texture_array promotion to 3.0 core */ -public static final int GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT = 0x884E; - /** Missed in the GL_EXT_framebuffer_sRGB promotion to 3.0 core */ public static final int GL_FRAMEBUFFER_SRGB_CAPABLE_EXT = 0x8DBA; diff --git a/make/config/jogl/gl-if-CustomJavaCode-gl3.java b/make/config/jogl/gl-if-CustomJavaCode-gl3.java new file mode 100644 index 000000000..1777c1557 --- /dev/null +++ b/make/config/jogl/gl-if-CustomJavaCode-gl3.java @@ -0,0 +1,8 @@ + +/** Part of GL_ARB_uniform_buffer_object */ +public static final int GL_INVALID_INDEX = 0xFFFFFFFF ; + +/** Part of GL_ARB_sync */ +public static final long GL_TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFFL ; + + diff --git a/make/config/jogl/gl-if-gl2_gl3.cfg b/make/config/jogl/gl-if-gl2_gl3.cfg index 0afe5d5b5..7f6903dd6 100644 --- a/make/config/jogl/gl-if-gl2_gl3.cfg +++ b/make/config/jogl/gl-if-gl2_gl3.cfg @@ -10,18 +10,18 @@ ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/G 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 +ExtendedInterfaceSymbolsOnly ../build-temp/gluegen-set/javax/media/opengl/GL3Set.java HierarchicalNativeOutput false Include gl-common.cfg Include gl-common-extensions.cfg +Include gl-desktop.cfg JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl # # Same name but different signature .. -# # No collisions found .. good! EmitProcAddressTable false @@ -30,10 +30,22 @@ 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 +GLHeader GL/gl.h +GLHeader GL/glext.h + +# Force all of the methods to be emitted using dynamic linking so we +# don't need to link against any emulation library on the desktop or +# depend on the presence of an import library for a particular device +ForceProcAddressGen __ALL__ + +# Also force the calling conventions of the locally generated function +# pointer typedefs for these routines to APIENTRY +LocalProcAddressCallingConvention __ALL__ APIENTRY # Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums TagNativeBinding true +# Ignore extensions that are already picked up via the GL2ES1 interface +IgnoreExtension GL_EXT_point_parameters + Import java.io.PrintStream diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java index 65236676a..c5831f426 100755 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java @@ -292,7 +292,7 @@ private Map/**/ arbVBOCache = new HashMap(); /** Entry point to C language function:
    LPVOID glMapBuffer(GLenum target, GLenum access); */ public java.nio.ByteBuffer glMapBuffer(int target, int access) { - final long __addr_ = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBufferOES; + final long __addr_ = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer; if (__addr_ == 0) { throw new GLException("Method \"glMapBuffer\" not available"); } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java index 2f69905a9..7e9b786b0 100755 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java @@ -302,7 +302,7 @@ private Map/**/ arbVBOCache = new HashMap(); /** Entry point to C language function:
    LPVOID glMapBuffer(GLenum target, GLenum access); */ public java.nio.ByteBuffer glMapBuffer(int target, int access) { - final long __addr_ = ((GLES2ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBufferOES; + final long __addr_ = ((GLES2ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer; if (__addr_ == 0) { throw new GLException("Method \"glMapBuffer\" not available"); } diff --git a/make/config/jogl/gl3-common.cfg b/make/config/jogl/gl3-common.cfg new file mode 100644 index 000000000..fac8323bb --- /dev/null +++ b/make/config/jogl/gl3-common.cfg @@ -0,0 +1,24 @@ + +# >>> OpenGL 3.1 +# See gl-common.cfg ! +# <<< OpenGL 3.1 + +# >>> OpenGL 3.2 +# Rename extension suffices (if exist) subsumed in OpenGL 3.2 (from OpenGL 3.2 spec, Appendix H.1) +RenameExtensionIntoCore GL_ARB_vertex_array_bgra +RenameExtensionIntoCore GL_ARB_draw_elements_base_vertex +RenameExtensionIntoCore GL_ARB_fragment_coord_conventions +RenameExtensionIntoCore GL_ARB_provoking_vertex +RenameExtensionIntoCore GL_ARB_seamless_cube_map +RenameExtensionIntoCore GL_ARB_texture_multisample +RenameExtensionIntoCore GL_ARB_depth_clamp +RenameExtensionIntoCore GL_ARB_geometry_shader4 +RenameExtensionIntoCore GL_ARB_sync +# <<< OpenGL 3.2 + +# Ignore GL functions that deal with explicit pointer values in such a +# way that we cannot implement the functionality in Java +Ignore glMultiDrawElementsBaseVertex + +Opaque long GLsync + diff --git a/make/config/jogl/gl3-desktop.cfg b/make/config/jogl/gl3-desktop.cfg index 2d34ade30..c3dd180bb 100755 --- a/make/config/jogl/gl3-desktop.cfg +++ b/make/config/jogl/gl3-desktop.cfg @@ -8,7 +8,6 @@ GLHeader GL3/gl3ext.h #Include gl-desktop-tracker.cfg - # # Directives needed when processing wglext.h on Windows and other platforms # diff --git a/make/config/jogl/glu-common.cfg b/make/config/jogl/glu-common.cfg index 3b5a1160a..df59175bb 100644 --- a/make/config/jogl/glu-common.cfg +++ b/make/config/jogl/glu-common.cfg @@ -1,3 +1,5 @@ +GLHeader GL/glu.h + # This .cfg file provides common options used among all GLU glue code HierarchicalNativeOutput false diff --git a/make/config/jogl/glx-x11.cfg b/make/config/jogl/glx-x11.cfg index 3ef151c44..c9079b84f 100644 --- a/make/config/jogl/glx-x11.cfg +++ b/make/config/jogl/glx-x11.cfg @@ -6,10 +6,13 @@ NativeOutputDir gensrc/native/jogl/X11 Package com.sun.opengl.impl.x11.glx JavaClass GLX Style allstatic -Include gl-common-gl2.cfg +Include gl-common.cfg Include gl-common-extensions.cfg Include gl-desktop.cfg +GLHeader GL/glx.h +GLHeader GL/glxext.h + EmitProcAddressTable true ProcAddressTableClassName GLXProcAddressTable GetProcAddressTableExpr glxProcAddressTable diff --git a/make/config/jogl/glxext.cfg b/make/config/jogl/glxext.cfg index ea4b6fe47..39ba379c4 100755 --- a/make/config/jogl/glxext.cfg +++ b/make/config/jogl/glxext.cfg @@ -10,9 +10,12 @@ ImplPackage com.sun.opengl.impl.x11.glx ImplJavaClass GLXExtImpl ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/sun/opengl/impl/x11/glx/GLX.java -Include gl-common-gl2.cfg +Include gl-common.cfg Include gl-desktop.cfg +GLHeader GL/glx.h +GLHeader GL/glxext.h + EmitProcAddressTable true ProcAddressTableClassName GLXExtProcAddressTable GetProcAddressTableExpr _context.getGLXExtProcAddressTable() diff --git a/make/config/jogl/wgl-win32.cfg b/make/config/jogl/wgl-win32.cfg index f86f1adcc..6cd4fd412 100644 --- a/make/config/jogl/wgl-win32.cfg +++ b/make/config/jogl/wgl-win32.cfg @@ -6,10 +6,15 @@ NativeOutputDir gensrc/native/jogl/Windows Package com.sun.opengl.impl.windows.wgl JavaClass WGL Style allstatic -Include gl-common-gl2.cfg +Include gl-common.cfg Include gl-common-extensions.cfg Include gl-desktop.cfg +AllowNonGLExtensions true + +GLHeader wingdi.h +GLHeader GL/wglext.h + # Implement the first argument to wglGetProcAddress as String instead # of byte[] ArgumentIsString wglGetProcAddress 0 diff --git a/make/config/jogl/wglext.cfg b/make/config/jogl/wglext.cfg index af4430bbe..ea9a0257e 100644 --- a/make/config/jogl/wglext.cfg +++ b/make/config/jogl/wglext.cfg @@ -8,9 +8,14 @@ Style InterfaceAndImpl JavaClass WGLExt ImplPackage com.sun.opengl.impl.windows.wgl ImplJavaClass WGLExtImpl -Include gl-common-gl2.cfg +Include gl-common.cfg Include gl-desktop.cfg +AllowNonGLExtensions true + +GLHeader wingdi.h +GLHeader GL/wglext.h + EmitProcAddressTable true ProcAddressTableClassName WGLExtProcAddressTable GetProcAddressTableExpr _context.getWGLExtProcAddressTable() diff --git a/make/stub_includes/egl/EGL/egl.h b/make/stub_includes/egl/EGL/egl.h index 86ca4818f..fc6cc4c87 100755 --- a/make/stub_includes/egl/EGL/egl.h +++ b/make/stub_includes/egl/EGL/egl.h @@ -39,6 +39,8 @@ typedef void *EGLClientBuffer; #define EGL_VERSION_1_3 1 #define EGL_VERSION_1_4 1 +#ifndef EGL_VERSION_1_X + /* EGL Enumerants. Bitmasks and other exceptional cases aside, most * enums are assigned unique values starting at 0x3000. */ @@ -226,7 +228,10 @@ typedef void *EGLClientBuffer; * a bug in Khronos Bugzilla against task "Registry". */ +#endif /* EGL_VERSION_1_X */ +#ifndef EGL_VERSION_1_X +#define EGL_VERSION_1_X 1 /* EGL Functions */ @@ -300,6 +305,8 @@ EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, typedef void (* EGLAPIENTRY __EGLFuncPtr)(void); EGLAPI __EGLFuncPtr eglGetProcAddress(const char *procname); +#endif /* EGL_VERSION_1_X */ + #ifdef __cplusplus } #endif diff --git a/make/stub_includes/egl/EGL/eglext.h b/make/stub_includes/egl/EGL/eglext.h index 5afa60118..7d7347e71 100755 --- a/make/stub_includes/egl/EGL/eglext.h +++ b/make/stub_includes/egl/EGL/eglext.h @@ -90,7 +90,7 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display #define EGL_KHR_image 1 #define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */ typedef void *EGLImageKHR; -#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) +/* Manual: #define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) */ #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, EGLint *attr_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); @@ -160,8 +160,8 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGL #define EGL_RAW_VALUE_NV 0x1239 #define EGL_PERCENTAGE_VALUE_NV 0x1240 #define EGL_BAD_CURRENT_PERFMONITOR_NV 0x1241 -#define EGL_NO_PERFMONITOR_NV ((EGLPerfMonitorNV)0) -#define EGL_DEFAULT_PERFMARKER_NV ((EGLPerfMarkerNV)0) +/* Manual: #define EGL_NO_PERFMONITOR_NV ((EGLPerfMonitorNV)0) */ +/* Manual: #define EGL_DEFAULT_PERFMARKER_NV ((EGLPerfMarkerNV)0) */ typedef void *EGLPerfMonitorNV; typedef void *EGLPerfMarkerNV; #ifdef USE_GLUEGEN @@ -272,31 +272,10 @@ EGLAPI EGLBoolean EGLAPIENTRY eglNvmaOutputSurfacePbufferUnlock(EGLDisplay displ #endif -/* EGL_KHR_sync +/** + * EGL_KHR_sync */ #ifndef EGL_KHR_sync -#define EGL_KHR_sync 1 -typedef void* EGLSyncKHR; -typedef void* NativeSyncKHR; -typedef uint64_t EGLTimeKHR; -#ifdef EGL_EGLEXT_PROTOTYPES -EGLSyncKHR eglCreateFenceSyncKHR( EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list ); -NativeSyncKHR eglCreateNativeSyncKHR( EGLSyncKHR sync ); -EGLBoolean eglDestroySyncKHR( EGLSyncKHR sync ); -EGLBoolean eglFenceKHR( EGLSyncKHR sync ); -EGLint eglClientWaitSyncKHR( EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout ); -EGLBoolean eglSignalSyncKHR( EGLSyncKHR sync, EGLenum mode ); -EGLBoolean eglGetSyncAttribKHR( EGLSyncKHR sync, EGLint attribute, EGLint *value ); -#else -typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATEFENCESYNCKHRPROC)( EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list ); -typedef NativeSyncKHR (EGLAPIENTRYP PFNEGLCREATENATIVESYNCKHRPROC)( EGLSyncKHR sync ); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC)( EGLSyncKHR sync ); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCEKHRPROC)( EGLSyncKHR sync ); -typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC)( EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout ); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC)( EGLSyncKHR sync, EGLenum mode ); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC)( EGLSyncKHR sync, EGLint attribute, EGLint *value ); -#endif - /* !!!!! TODO: Get correct values for these defines !!!! Do not rely on these values...THEY WILL CHANGE! And it WILL BREAK binary compatibility when they do! */ @@ -306,7 +285,7 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC)( EGLSyncKHR sync, E #define EGL_SIGNALED_KHR 0x3103 #define EGL_UNSIGNALED_KHR 0x3104 #define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 -#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull +/* Manual: #define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull */ #define EGL_ALREADY_SIGNALED_KHR 0x3105 #define EGL_TIMEOUT_EXPIRED_KHR 0x3106 #define EGL_CONDITION_SATISFIED_KHR 0x3107 @@ -314,9 +293,32 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC)( EGLSyncKHR sync, E #define EGL_SYNC_CONDITION_KHR 0x3109 #define EGL_SYNC_FENCE_KHR 0x310A #define EGL_NO_SYNC_KHR 0x0000 -#endif +typedef void* EGLSyncKHR; +typedef void* NativeSyncKHR; +typedef uint64_t EGLTimeKHR; + +#endif +#ifndef EGL_KHR_sync +#define EGL_KHR_sync 1 +#ifdef EGL_EGLEXT_PROTOTYPES +EGLSyncKHR eglCreateFenceSyncKHR( EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list ); +NativeSyncKHR eglCreateNativeSyncKHR( EGLSyncKHR sync ); +EGLBoolean eglDestroySyncKHR( EGLSyncKHR sync ); +EGLBoolean eglFenceKHR( EGLSyncKHR sync ); +EGLint eglClientWaitSyncKHR( EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout ); +EGLBoolean eglSignalSyncKHR( EGLSyncKHR sync, EGLenum mode ); +EGLBoolean eglGetSyncAttribKHR( EGLSyncKHR sync, EGLint attribute, EGLint *value ); +#endif +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATEFENCESYNCKHRPROC)( EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list ); +typedef NativeSyncKHR (EGLAPIENTRYP PFNEGLCREATENATIVESYNCKHRPROC)( EGLSyncKHR sync ); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC)( EGLSyncKHR sync ); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCEKHRPROC)( EGLSyncKHR sync ); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC)( EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout ); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC)( EGLSyncKHR sync, EGLenum mode ); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC)( EGLSyncKHR sync, EGLint attribute, EGLint *value ); +#endif /* EGL_NV_omx_il_sink */ diff --git a/make/stub_includes/opengl/GL/glext.h b/make/stub_includes/opengl/GL/glext.h index 68bf425cf..b2c23a822 100644 --- a/make/stub_includes/opengl/GL/glext.h +++ b/make/stub_includes/opengl/GL/glext.h @@ -1185,6 +1185,13 @@ extern "C" { #define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 #endif +#ifndef GL_EXT_texture_rectangle +#define GL_TEXTURE_RECTANGLE_EXT 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_EXT 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_EXT 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT 0x84F8 +#endif + #ifndef GL_ARB_color_buffer_float #define GL_RGBA_FLOAT_MODE_ARB 0x8820 #define GL_CLAMP_VERTEX_COLOR_ARB 0x891A @@ -3150,16 +3157,6 @@ extern "C" { #define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED #endif -/* Support for GL_EXT_texture_rectangle on non-nVidia cards */ -#ifndef GL_EXT_texture_rectangle -#define GL_EXT_texture_rectangle 1 -#define GL_TEXTURE_RECTANGLE_EXT 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE_EXT 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE_EXT 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT 0x84F8 -#endif /* GL_TEXTURE_RECTANGLE_EXT */ - - #ifndef GL_ATI_vertex_streams #define GL_MAX_VERTEX_STREAMS_ATI 0x876B #define GL_VERTEX_STREAM0_ATI 0x876C @@ -3318,6 +3315,23 @@ extern "C" { #define GL_MODULATE_SUBTRACT_ATI 0x8746 #endif +#ifndef GL_APPLE_float_pixels +#define GL_HALF_APPLE 0x140B +#define GL_COLOR_FLOAT_APPLE 0x8A0F +#define GL_RGBA_FLOAT32_APPLE 0x8814 +#define GL_RGB_FLOAT32_APPLE 0x8815 +#define GL_ALPHA_FLOAT32_APPLE 0x8816 +#define GL_INTENSITY_FLOAT32_APPLE 0x8817 +#define GL_LUMINANCE_FLOAT32_APPLE 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 +#define GL_RGBA_FLOAT16_APPLE 0x881A +#define GL_RGB_FLOAT16_APPLE 0x881B +#define GL_ALPHA_FLOAT16_APPLE 0x881C +#define GL_INTENSITY_FLOAT16_APPLE 0x881D +#define GL_LUMINANCE_FLOAT16_APPLE 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F +#endif + #ifndef GL_ATI_texture_float #define GL_RGBA_FLOAT32_ATI 0x8814 #define GL_RGB_FLOAT32_ATI 0x8815 @@ -3792,7 +3806,7 @@ extern "C" { #define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6 #endif -#ifndef NV_parameter_buffer_object +#ifndef GL_NV_parameter_buffer_object #define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 #define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 #define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 @@ -3810,9 +3824,9 @@ extern "C" { #endif #ifndef GL_EXT_texture_compression_rgtc -#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB -#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC -#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD #define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE #endif @@ -5142,6 +5156,10 @@ typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs) #define GL_ARB_texture_rectangle 1 #endif +#ifndef GL_EXT_texture_rectangle +#define GL_EXT_texture_rectangle 1 +#endif + #ifndef GL_ARB_color_buffer_float #define GL_ARB_color_buffer_float 1 #ifdef GL_GLEXT_PROTOTYPES @@ -7329,6 +7347,10 @@ typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs) #define GL_ATI_texture_env_combine3 1 #endif +#ifndef GL_APPLE_float_pixels +#define GL_APPLE_float_pixels 1 +#endif + #ifndef GL_ATI_texture_float #define GL_ATI_texture_float 1 #endif @@ -8035,7 +8057,7 @@ GLAPI void APIENTRY glBindBufferRangeEXT (GLenum, GLuint, GLuint, GLintptr, GLsi GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum, GLuint, GLuint, GLintptr); GLAPI void APIENTRY glBindBufferBaseEXT (GLenum, GLuint, GLuint); GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint, GLsizei, const GLchar **, GLenum); -GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint, GLuint, GLint *); +GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode); typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void); @@ -8043,7 +8065,7 @@ typedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint inde typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); typedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer); typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLint *location); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); #endif #ifndef GL_EXT_direct_state_access @@ -8436,6 +8458,7 @@ typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenu /** * http://www.opengl.org/registry/specs/AMD/vertex_shader_tessellator.txt */ + #ifndef GL_AMD_vertex_shader_tessellator #define GL_SAMPLER_BUFFER_AMD 0x9001 #define GL_INT_SAMPLER_BUFFER_AMD 0x9002 @@ -8447,7 +8470,7 @@ typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenu #endif #ifndef GL_AMD_vertex_shader_tessellator -#define GL_AMD_vertex_shader_tessellator +#define GL_AMD_vertex_shader_tessellator 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glTessellationFactorAMD(GLfloat factor); GLAPI void APIENTRY glTessellationModeAMD(GLenum mode); @@ -8522,23 +8545,6 @@ typedef void (APIENTRY * PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei len typedef void (APIENTRY * PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, GLvoid **params); #endif -#ifndef GL_APPLE_float_pixels -#define GL_HALF_APPLE 0x140B -#define GL_COLOR_FLOAT_APPLE 0x8A0F -#define GL_RGBA_FLOAT32_APPLE 0x8814 -#define GL_RGB_FLOAT32_APPLE 0x8815 -#define GL_ALPHA_FLOAT32_APPLE 0x8816 -#define GL_INTENSITY_FLOAT32_APPLE 0x8817 -#define GL_LUMINANCE_FLOAT32_APPLE 0x8818 -#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 -#define GL_RGBA_FLOAT16_APPLE 0x881A -#define GL_RGB_FLOAT16_APPLE 0x881B -#define GL_ALPHA_FLOAT16_APPLE 0x881C -#define GL_INTENSITY_FLOAT16_APPLE 0x881D -#define GL_LUMINANCE_FLOAT16_APPLE 0x881E -#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F -#endif - #ifndef GL_APPLE_pixel_buffer #define GL_MIN_PBUFFER_VIEWPORT_DIMS_APPLE 0x8A10 #endif diff --git a/make/stub_includes/opengl/GL/glu.h b/make/stub_includes/opengl/GL/glu.h index bccda7f8e..e3a16f304 100644 --- a/make/stub_includes/opengl/GL/glu.h +++ b/make/stub_includes/opengl/GL/glu.h @@ -62,6 +62,13 @@ extern "C" { /*************************************************************/ +/* Version */ +#define GLU_VERSION_1_1 1 +#define GLU_VERSION_1_2 1 +#define GLU_VERSION_1_3 1 + +#ifndef GLU_VERSION_1_X + /* Extensions */ #define GLU_EXT_object_space_tess 1 #define GLU_EXT_nurbs_tessellator 1 @@ -70,11 +77,6 @@ extern "C" { #define GLU_FALSE 0 #define GLU_TRUE 1 -/* Version */ -#define GLU_VERSION_1_1 1 -#define GLU_VERSION_1_2 1 -#define GLU_VERSION_1_3 1 - /* StringName */ #define GLU_VERSION 100800 #define GLU_EXTENSIONS 100801 @@ -280,6 +282,11 @@ typedef GLUtesselator GLUtriangulatorObj; /* Internal convenience typedefs */ typedef void (GLAPIENTRY *_GLUfuncptr)(); +#endif /* GLX_VERSION_1_X */ + +#ifndef GLU_VERSION_1_X +#define GLU_VERSION_1_X 1 + GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb); GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess); GLAPI void GLAPIENTRY gluBeginSurface (GLUnurbs* nurb); @@ -401,6 +408,8 @@ typedef void (GLAPIENTRY * PFNGLUTESSVERTEXPROC) (GLUtesselator* tess, GLdouble typedef GLint (GLAPIENTRY * PFNGLUUNPROJECTPROC) (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ); typedef GLint (GLAPIENTRY * PFNGLUUNPROJECT4PROC) (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW); +#endif /* GLU_VERSION_1_X */ + #ifdef __cplusplus } #endif diff --git a/make/stub_includes/opengl/GL/glx.h b/make/stub_includes/opengl/GL/glx.h index 4032f45da..67225e043 100644 --- a/make/stub_includes/opengl/GL/glx.h +++ b/make/stub_includes/opengl/GL/glx.h @@ -66,9 +66,9 @@ extern "C" { #define GLX_VERSION_1_4 1 */ -#define GLX_EXTENSION_NAME "GLX" - +#ifndef GLX_VERSION_1_X +#define GLX_EXTENSION_NAME "GLX" /* * Tokens for glXChooseVisual and glXGetConfig: @@ -192,8 +192,12 @@ typedef XID GLXContextID; typedef XID GLXWindow; typedef XID GLXPbuffer; +#endif /* GLX_VERSION_1_X */ +#ifndef GLX_VERSION_1_X +#define GLX_VERSION_1_X 1 + extern XVisualInfo* glXChooseVisual( Display *dpy, int screen, int *attribList ); @@ -300,6 +304,8 @@ extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable, /* GLX 1.4 and later */ extern void (*glXGetProcAddress(const GLubyte *procname))(); +#endif /* GLX_VERSION_1_X */ + #ifndef GLX_GLXEXT_LEGACY #include diff --git a/make/stub_includes/opengl/GL/glxext.h b/make/stub_includes/opengl/GL/glxext.h index 2ed99a824..ad580022e 100644 --- a/make/stub_includes/opengl/GL/glxext.h +++ b/make/stub_includes/opengl/GL/glxext.h @@ -266,16 +266,13 @@ extern "C" { typedef void (*__GLXextFuncPtr)(void); -#ifdef GLX_GLXEXT_PROTOTYPES -extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName); - #ifndef GLX_ARB_get_proc_address #define GLX_ARB_get_proc_address 1 #ifdef GLX_GLXEXT_PROTOTYPES +extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *); extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *); #endif /* GLX_GLXEXT_PROTOTYPES */ +typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName); typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName); #endif @@ -868,9 +865,9 @@ typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, #endif #ifndef GLX_NV_present_video -#define GLX_NV_present_video +#define GLX_NV_present_video 1 #ifdef GLX_GLXEXT_PROTOTYPES -extern unsigned int *glXEnumerateVideoDevicesNV(Display *dpy, +extern unsigned int* glXEnumerateVideoDevicesNV(Display *dpy, int screen, int *nelements); extern int glXBindVideoDeviceNV(Display *dpy, diff --git a/make/stub_includes/opengl/GL3/gl3.h b/make/stub_includes/opengl/GL3/gl3.h index 41ed2ad2e..7db3851bd 100755 --- a/make/stub_includes/opengl/GL3/gl3.h +++ b/make/stub_includes/opengl/GL3/gl3.h @@ -1059,7 +1059,7 @@ typedef void GLvoid; #define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 #define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 #define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 -#define GL_INVALID_INDEX 0xFFFFFFFFu +/** Manual: #define GL_INVALID_INDEX -1 == (int) 0xFFFFFFFFu */ #endif #ifndef GL_ARB_copy_buffer @@ -1103,8 +1103,6 @@ typedef unsigned short GLhalfARB; typedef unsigned short GLhalfNV; #endif -#include "glext-64bit-types.h" - #ifndef GL_VERSION_1_0 #define GL_VERSION_1_0 1 #ifdef GL3_PROTOTYPES diff --git a/make/stub_includes/opengl/GL3/gl3ext.h b/make/stub_includes/opengl/GL3/gl3ext.h index 8dcc9b4a3..7d391921f 100644 --- a/make/stub_includes/opengl/GL3/gl3ext.h +++ b/make/stub_includes/opengl/GL3/gl3ext.h @@ -1,6 +1,185 @@ #ifndef __gl3ext_h_ #define __gl3ext_h_ +#include "gl3-64bit-types.h" + +/* + * ------------------------------------------------ + * Everything here and below was added manually + * to the version of glext.h obtained from: + * http://oss.sgi.com/projects/ogl-sample/registry/index.html + * ------------------------------------------------ + * + * Structure is: + * #ifndef GL_EXTENSION_NAME + * Add DEFINES here + * #endif + * #ifndef GL_EXTENSION_NAME + * Add TYPEDEFS here + * #endif + * #ifndef GL_EXTENSION_NAME + * #define GL_EXTENSION_NAME 1 + * #ifdef GL_GL3EXT_PROTOTYPES + * Add FUNCTION DECLARATIONS here + * #endif + * FUNCTION POINTER DECLARATIONS NOT NEEDED + * #endif + */ + +#ifndef GL_VERSION_3_2 +#define GL_VERSION_3_2 1 +/* OpenGL 3.2 also reuses entry points from these extensions: */ +/* ARB_vertex_array_bgra */ +/* ARB_draw_elements_base_vertex */ +/* ARB_fragment_coord_conventions */ +/* ARB_provoking_vertex */ +/* ARB_seamless_cube_map */ +/* ARB_texture_multisample */ +/* ARB_depth_clamp */ +/* ARB_geometry_shader4 */ +/* ARB_sync */ +#ifdef GL_GL3EXT_PROTOTYPES +#endif /* GL3_PROTOTYPES */ +#endif + +/** + * http://www.opengl.org/registry/specs/ARB/vertex_array_bgra.txt + */ +#ifndef GL_ARB_vertex_array_bgra +#define GL_BGRA 0x80E1 +#endif +#ifndef GL_ARB_vertex_array_bgra +#define GL_ARB_vertex_array_bgra 1 +#ifdef GL_GL3EXT_PROTOTYPES +/* No FUNCTIONS */ +#endif +/* No need for explicit function pointer: we force generation of ProcAddress .. */ +#endif + +/** + * http://www.opengl.org/registry/specs/ARB/draw_elements_base_vertex.txt + */ +#ifndef GL_ARB_draw_elements_base_vertex +/* No TOKENS */ +#endif +#ifndef GL_ARB_draw_elements_base_vertex +#define GL_ARB_draw_elements_base_vertex 1 +#ifdef GL_GL3EXT_PROTOTYPES +GLAPI void APIENTRY glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, + GLvoid *indices, GLint basevertex); +GLAPI void APIENTRY glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, + GLsizei count, GLenum type, GLvoid *indices, GLint basevertex); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, + GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex); +GLAPI void APIENTRY glMultiDrawElementsBaseVertex(GLenum mode, GLsizei *count, GLenum type, + GLvoid **indices, GLsizei primcount, GLint *basevertex); +#endif +/* No need for explicit function pointer: we force generation of ProcAddress .. */ +#endif + +/** + * http://www.opengl.org/registry/specs/ARB/fragment_coord_conventions.txt + */ +#ifndef GL_ARB_fragment_coord_conventions +/* No Tokens */ +#endif +#ifndef GL_ARB_fragment_coord_conventions +#define GL_ARB_fragment_coord_conventions 1 +#ifdef GL_GL3EXT_PROTOTYPES +/* No Functions */ +#endif +/* No need for explicit function pointer: we force generation of ProcAddress .. */ +#endif + +/** + * http://www.opengl.org/registry/specs/ARB/provoking_vertex.txt + */ +#ifndef GL_ARB_provoking_vertex +#define GL_FIRST_VERTEX_CONVENTION 0x8E4D +#define GL_LAST_VERTEX_CONVENTION 0x8E4E +#define GL_PROVOKING_VERTEX 0x8E4F +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C +#endif +#ifndef GL_ARB_provoking_vertex +#define GL_ARB_provoking_vertex 1 +#ifdef GL_GL3EXT_PROTOTYPES +GLAPI void APIENTRY glProvokingVertex(GLenum mode); +#endif +/* No need for explicit function pointer: we force generation of ProcAddress .. */ +#endif + +/** + * http://www.opengl.org/registry/specs/ARB/seamless_cube_map.txt + */ +#ifndef GL_ARB_seamless_cube_map +#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F +#endif +#ifndef GL_ARB_seamless_cube_map +#define GL_ARB_seamless_cube_map 1 +#ifdef GL_GL3EXT_PROTOTYPES +/* No Functions */ +#endif +/* No need for explicit function pointer: we force generation of ProcAddress .. */ +#endif + +/** + * http://www.opengl.org/registry/specs/ARB/texture_multisample.txt + */ +#ifndef GL_ARB_texture_multisample +#define GL_SAMPLE_POSITION 0x8E50 +#define GL_SAMPLE_MASK 0x8E51 +#define GL_SAMPLE_MASK_VALUE 0x8E52 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 +#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 +#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E +#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F +#define GL_MAX_INTEGER_SAMPLES 0x9110 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 +#define GL_TEXTURE_SAMPLES 0x9106 +#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 +#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 +#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D +#endif +#ifndef GL_ARB_texture_multisample +#define GL_ARB_texture_multisample 1 +#ifdef GL_GL3EXT_PROTOTYPES +GLAPI void APIENTRY glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, + GLsizei width, GLsizei height, + GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, + GLsizei width, GLsizei height, GLsizei depth, + GLboolean fixedsamplelocations); +GLAPI void APIENTRY glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val); +GLAPI void APIENTRY glSampleMaski(GLuint index, GLbitfield mask); +#endif +/* No need for explicit function pointer: we force generation of ProcAddress .. */ +#endif + +/** + * http://www.opengl.org/registry/specs/ARB/depth_clamp.txt + */ +#ifndef GL_ARB_depth_clamp +#define GL_DEPTH_CLAMP 0x864F +#endif +#ifndef GL_ARB_depth_clamp +#define GL_ARB_depth_clamp 1 +#ifdef GL_GL3EXT_PROTOTYPES +/* No FUNCTIONS */ +#endif +/* No need for explicit function pointer: we force generation of ProcAddress .. */ +#endif + +/** + * http://www.opengl.org/registry/specs/ARB/geometry_shader4.txt + */ #ifndef GL_ARB_geometry_shader4 #define GL_LINES_ADJACENCY_ARB 0x000A #define GL_LINE_STRIP_ADJACENCY_ARB 0x000B @@ -23,7 +202,6 @@ /* reuse GL_MAX_VARYING_COMPONENTS */ /* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ #endif - #ifndef GL_ARB_geometry_shader4 #define GL_ARB_geometry_shader4 1 #ifdef GL_GL3EXT_PROTOTYPES @@ -31,22 +209,62 @@ GLAPI void APIENTRY glProgramParameteriARB (GLuint, GLenum, GLint); GLAPI void APIENTRY glFramebufferTextureARB (GLenum, GLenum, GLuint, GLint); GLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum, GLenum, GLuint, GLint, GLint); GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum, GLenum, GLuint, GLint, GLenum); -#endif /* GL_GL3EXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#endif +/* No need for explicit function pointer: we force generation of ProcAddress .. */ #endif +/** + * http://www.opengl.org/registry/specs/ARB/sync.txt + */ +#ifndef GL_ARB_sync +#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 +#define GL_OBJECT_TYPE 0x9112 +#define GL_SYNC_CONDITION 0x9113 +#define GL_SYNC_STATUS 0x9114 +#define GL_SYNC_FLAGS 0x9115 +#define GL_SYNC_FENCE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 +#define GL_UNSIGNALED 0x9118 +#define GL_SIGNALED 0x9119 +#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 +/* Manual: #define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFul */ +#define GL_ALREADY_SIGNALED 0x911A +#define GL_TIMEOUT_EXPIRED 0x911B +#define GL_CONDITION_SATISFIED 0x911C +#define GL_WAIT_FAILED 0x911D +#endif +#ifndef GL_ARB_sync +typedef int64_t GLint64; +typedef uint64_t GLuint64; +typedef struct __GLsync *GLsync; +#endif +#ifndef GL_ARB_sync +#define GL_ARB_sync 1 +#ifdef GL_GL3EXT_PROTOTYPES +GLAPI GLsync APIENTRY glFenceSync(GLenum condition, GLbitfield flags); +GLAPI GLboolean APIENTRY glIsSync(GLsync sync); +GLAPI void APIENTRY glDeleteSync(GLsync sync); +GLAPI GLenum APIENTRY glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI void APIENTRY glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI void APIENTRY glGetInteger64v(GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#endif +/* No need for explicit function pointer: we force generation of ProcAddress .. */ +#endif -/* - * ------------------------------------------------ - * Everything here and below was added manually - * to the version of glext.h obtained from: - * http://oss.sgi.com/projects/ogl-sample/registry/index.html - * ------------------------------------------------ +/** + * Convenient names only .. actually subsumed into core */ - +#ifndef GL_ARB_texture_rectangle +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_ARB_texture_rectangle 1 +#endif /** * http://www.opengl.org/registry/specs/AMD/vertex_shader_tessellator.txt @@ -60,9 +278,8 @@ typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLen #define GL_TESSELLATION_MODE_AMD 0x9004 #define GL_TESSELLATION_FACTOR_AMD 0x9005 #endif - #ifndef GL_AMD_vertex_shader_tessellator -#define GL_AMD_vertex_shader_tessellator +#define GL_AMD_vertex_shader_tessellator 1 #ifdef GL_GL3EXT_PROTOTYPES GLAPI void APIENTRY glTessellationFactorAMD(GLfloat factor); GLAPI void APIENTRY glTessellationModeAMD(GLenum mode); @@ -71,5 +288,67 @@ typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor); typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode); #endif +#ifndef GL_APPLE_float_pixels +#define GL_HALF_APPLE 0x140B +#define GL_COLOR_FLOAT_APPLE 0x8A0F +#define GL_RGBA_FLOAT32_APPLE 0x8814 +#define GL_RGB_FLOAT32_APPLE 0x8815 +#define GL_ALPHA_FLOAT32_APPLE 0x8816 +#define GL_INTENSITY_FLOAT32_APPLE 0x8817 +#define GL_LUMINANCE_FLOAT32_APPLE 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 +#define GL_RGBA_FLOAT16_APPLE 0x881A +#define GL_RGB_FLOAT16_APPLE 0x881B +#define GL_ALPHA_FLOAT16_APPLE 0x881C +#define GL_INTENSITY_FLOAT16_APPLE 0x881D +#define GL_LUMINANCE_FLOAT16_APPLE 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F #endif +#ifndef GL_APPLE_float_pixels +#define GL_APPLE_float_pixels 1 +#endif + +#ifndef GL_ATI_texture_float +#define GL_RGBA_FLOAT32_ATI 0x8814 +#define GL_RGB_FLOAT32_ATI 0x8815 +#define GL_ALPHA_FLOAT32_ATI 0x8816 +#define GL_INTENSITY_FLOAT32_ATI 0x8817 +#define GL_LUMINANCE_FLOAT32_ATI 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 +#define GL_RGBA_FLOAT16_ATI 0x881A +#define GL_RGB_FLOAT16_ATI 0x881B +#define GL_ALPHA_FLOAT16_ATI 0x881C +#define GL_INTENSITY_FLOAT16_ATI 0x881D +#define GL_LUMINANCE_FLOAT16_ATI 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F +#endif + +#ifndef GL_ATI_texture_float +#define GL_ATI_texture_float 1 +#endif + +#ifndef GL_NV_float_buffer +#define GL_FLOAT_R_NV 0x8880 +#define GL_FLOAT_RG_NV 0x8881 +#define GL_FLOAT_RGB_NV 0x8882 +#define GL_FLOAT_RGBA_NV 0x8883 +#define GL_FLOAT_R16_NV 0x8884 +#define GL_FLOAT_R32_NV 0x8885 +#define GL_FLOAT_RG16_NV 0x8886 +#define GL_FLOAT_RG32_NV 0x8887 +#define GL_FLOAT_RGB16_NV 0x8888 +#define GL_FLOAT_RGB32_NV 0x8889 +#define GL_FLOAT_RGBA16_NV 0x888A +#define GL_FLOAT_RGBA32_NV 0x888B +#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C +#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D +#define GL_FLOAT_RGBA_MODE_NV 0x888E +#endif + +#ifndef GL_NV_float_buffer +#define GL_NV_float_buffer 1 +#endif + +#endif /* __gl3ext_h_ */ + diff --git a/make/stub_includes/opengl/GLES/gl.h b/make/stub_includes/opengl/GLES/gl.h index da71230b5..41afe2239 100755 --- a/make/stub_includes/opengl/GLES/gl.h +++ b/make/stub_includes/opengl/GLES/gl.h @@ -71,6 +71,8 @@ typedef int GLsizeiptr; #define GL_VERSION_ES_CM_1_1 1 #define GL_VERSION_ES_CL_1_1 1 +#ifndef GL_VERSION_ES_1_0 + /* ClearBufferMask */ #define GL_DEPTH_BUFFER_BIT 0x00000100 #define GL_STENCIL_BUFFER_BIT 0x00000400 @@ -576,6 +578,8 @@ typedef int GLsizeiptr; #define GL_DOT3_RGB 0x86AE #define GL_DOT3_RGBA 0x86AF +#endif /* GL_VERSION_ES_1_0 */ + /*------------------------------------------------------------------------* * required OES extension tokens *------------------------------------------------------------------------*/ @@ -617,6 +621,8 @@ typedef int GLsizeiptr; /*************************************************************/ +#ifndef GL_VERSION_ES_CM +#define GL_VERSION_ES_CM 1 /* Available only in Common profile */ GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLclampf ref); GL_API void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); @@ -658,7 +664,10 @@ GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat * GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z); +#endif /* GL_VERSION_ES_CM */ +#ifndef GL_VERSION_ES_CL_CM +#define GL_VERSION_ES_CL 1 /* Available in both Common and Common-Lite profiles */ GL_API void GL_APIENTRY glActiveTexture (GLenum texture); GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref); @@ -768,6 +777,7 @@ GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffs GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z); GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); +#endif /* GL_VERSION_ES_CL */ /*------------------------------------------------------------------------* * Required OES extension functions diff --git a/make/stub_includes/opengl/GLES/glext.h b/make/stub_includes/opengl/GLES/glext.h index ee6ebae20..f9e181dd0 100755 --- a/make/stub_includes/opengl/GLES/glext.h +++ b/make/stub_includes/opengl/GLES/glext.h @@ -244,7 +244,6 @@ typedef void* GLeglImageOES; #define GL_3DC_XY_AMD 0x87FA #endif -/* GL_AMD_compressed_ATC_texture */ #ifndef GL_AMD_compressed_ATC_texture #define GL_ATC_RGB_AMD 0x8C92 #define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 @@ -634,7 +633,6 @@ typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum #define GL_AMD_compressed_3DC_texture 1 #endif -/* GL_AMD_compressed_ATC_texture */ #ifndef GL_AMD_compressed_ATC_texture #define GL_AMD_compressed_ATC_texture 1 #endif diff --git a/make/stub_includes/opengl/GLES2/gl2.h b/make/stub_includes/opengl/GLES2/gl2.h index 9c68b1e7a..44338000e 100755 --- a/make/stub_includes/opengl/GLES2/gl2.h +++ b/make/stub_includes/opengl/GLES2/gl2.h @@ -99,8 +99,7 @@ typedef int GLclampx; typedef int GLintptr; typedef int GLsizeiptr; -/* OpenGL ES core versions */ -#define GL_ES_VERSION_2_0 1 +#ifndef GL_ES_VERSION_2_0 /* ClearBufferMask */ #define GL_DEPTH_BUFFER_BIT 0x00000100 @@ -532,10 +531,14 @@ typedef int GLsizeiptr; #define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +#endif /* GL_ES_VERSION_2_0 */ + /*------------------------------------------------------------------------- * GL core functions. *-----------------------------------------------------------------------*/ +#ifndef GL_ES_VERSION_2_0 +#define GL_ES_VERSION_2_0 1 GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const char* name); @@ -678,6 +681,7 @@ GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GL GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values); GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr); GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); +#endif /* GL_ES_VERSION_2_0 */ #ifdef __cplusplus } diff --git a/make/stub_includes/opengl/GLES2/gl2ext.h b/make/stub_includes/opengl/GLES2/gl2ext.h index 8580e2bdf..e3bbede8a 100755 --- a/make/stub_includes/opengl/GLES2/gl2ext.h +++ b/make/stub_includes/opengl/GLES2/gl2ext.h @@ -61,9 +61,7 @@ extern "C" { #define GL_NVIDIA_PLATFORM_BINARY_NV 0x890B -#define GL_OES_EGL_image 1 - -#ifdef GL_OES_EGL_image +#ifndef GL_OES_EGL_image /** sgothel: wrong defines and/or numbers: * #define GL_TEXTURE_2D_OES 0x1 @@ -76,12 +74,17 @@ extern "C" { #define GL_RENDERBUFFER_OES 0x9 #define GL_TEXTURE_RECTANGLE_NV_OES 0xb */ +#endif /* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image typedef void *GLeglImageOES; +#endif /* GL_OES_EGL_image */ + +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image); #ifdef GL_GLEXT_PROTOTYPES typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); - #endif #endif diff --git a/make/stub_includes/opengl/gl2es12.c b/make/stub_includes/opengl/gl2es12.c index 75cb4acfc..bc9d24ace 100644 --- a/make/stub_includes/opengl/gl2es12.c +++ b/make/stub_includes/opengl/gl2es12.c @@ -6,8 +6,3 @@ #include -// removed due to renaming and the fact that the renamed version is not included -// in the super interfaces .. -GLAPI void APIENTRY glWeightPointer (GLint, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glMatrixIndexPointer (GLint, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCurrentPaletteMatrix (GLint); diff --git a/make/stub_includes/opengl/gl3-64bit-types.h b/make/stub_includes/opengl/gl3-64bit-types.h new file mode 100644 index 000000000..fc8b4ce05 --- /dev/null +++ b/make/stub_includes/opengl/gl3-64bit-types.h @@ -0,0 +1,41 @@ +#ifndef __gl3_64bit_types_h_ +#define __gl3_64bit_types_h_ + +#ifndef GL3_64_TYPES_DEFINED + /* This code block is duplicated in glext.h, so must be protected */ + #define GL3_64_TYPES_DEFINED + /* Define int32_t, int64_t, and uint64_t types for UST/MSC */ + /* (as used in the GL_EXT_timer_query extension). */ + #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #include + #elif defined(__sun__) + #include + #if defined(__STDC__) + #if defined(__arch64__) + typedef long int int64_t; + typedef unsigned long int uint64_t; + #else + typedef long long int int64_t; + typedef unsigned long long int uint64_t; + #endif /* __arch64__ */ + #endif /* __STDC__ */ + #elif defined( __VMS ) + #include + #elif defined(__SCO__) || defined(__USLC__) + #include + #elif defined(__UNIXOS2__) || defined(__SOL64__) + typedef long int int32_t; + typedef long long int int64_t; + typedef unsigned long long int uint64_t; + #elif defined(WIN32) && defined(__GNUC__) + #include + #elif defined(_WIN32) + typedef __int32 int32_t; + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; + #else + #include /* Fallback option */ + #endif +#endif + +#endif /* __gl3_64bit_types_h_ */ diff --git a/make/stub_includes/opengl/glu-impl.c b/make/stub_includes/opengl/glu-impl.c deleted file mode 100644 index 2328639d8..000000000 --- a/make/stub_includes/opengl/glu-impl.c +++ /dev/null @@ -1,3 +0,0 @@ -#include - - diff --git a/make/stub_includes/win32/wingdi.h b/make/stub_includes/win32/wingdi.h index 4d980755b..46aeec2b6 100644 --- a/make/stub_includes/win32/wingdi.h +++ b/make/stub_includes/win32/wingdi.h @@ -6,6 +6,8 @@ * */ +#ifndef WGL_GDI_VERSION_1_X + typedef struct tagRGBQUAD { BYTE rgbBlue; BYTE rgbGreen; @@ -163,6 +165,11 @@ typedef struct tagPIXELFORMATDESCRIPTOR #define SW_FORCEMINIMIZE 11 #define SW_MAX 11 +#endif /* WGL_GDI_VERSION_1_X */ + +#ifndef WGL_GDI_VERSION_1_X +#define WGL_GDI_VERSION_1_X + // Windows routines WINBASEAPI DWORD WINAPI GetLastError(VOID); WINBASEAPI HMODULE WINAPI LoadLibraryA(LPCSTR lpLibFileName); @@ -214,3 +221,5 @@ WINUSERAPI BOOL WINAPI DestroyWindow(HWND hWnd); // Routines for changing gamma ramp of display device WINGDIAPI BOOL WINAPI GetDeviceGammaRamp(HDC,LPVOID); WINGDIAPI BOOL WINAPI SetDeviceGammaRamp(HDC,LPVOID); + +#endif /* WGL_GDI_VERSION_1_X */ diff --git a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java index d1a35b1b6..16eb934bd 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java @@ -61,7 +61,6 @@ public abstract class GLContextImpl extends GLContext { // platforms anyway in particular with the disabling of the // GLWorkerThread which we found to be necessary in 1.0 beta 4. protected boolean optimizationEnabled = Debug.isPropertyDefined("jogl.GLContext.optimize", true); - protected boolean tryGLContext3_2 = Debug.isPropertyDefined("jogl.GLContext.3_2", true); // Cache of the functions that are available to be called at the current // moment in time diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java index 4ea3519bf..0754c4b57 100644 --- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java @@ -86,7 +86,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { rect = false; } } - textureTarget = (rect ? GL2.GL_TEXTURE_RECTANGLE_EXT: GL.GL_TEXTURE_2D); + textureTarget = (rect ? GL2.GL_TEXTURE_RECTANGLE : GL.GL_TEXTURE_2D); int[] tmp = new int[1]; gl.glGenTextures(1, tmp, 0); texture = tmp[0]; 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 0d031ffff..2d7b3ea34 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 @@ -98,7 +98,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { GLProfile glProfile = capabilities.getGLProfile(); int renderTarget; if (glProfile.isGL2() && capabilities.getPbufferRenderToTextureRectangle()) { - renderTarget = GL2.GL_TEXTURE_RECTANGLE_EXT; + renderTarget = GL2.GL_TEXTURE_RECTANGLE; } else { int w = getNextPowerOf2(getWidth()); int h = getNextPowerOf2(getHeight()); 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 e459d0c5a..9a3860ae2 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 @@ -178,7 +178,8 @@ public class WindowsWGLContext extends GLContextImpl { if(glCaps.getGLProfile().isGL3()) { // Try >= 3.2 core first ! - // In contrast to GLX no verify with a None drawable binding (default framebuffer) is necessary. + // In contrast to GLX no verify with a None drawable binding (default framebuffer) is necessary, + // if no 3.2 is available creation fails already! attribs[0+1] = 3; attribs[2+1] = 2; attribs[6+0] = WGLExt.WGL_CONTEXT_PROFILE_MASK_ARB; @@ -186,7 +187,7 @@ public class WindowsWGLContext extends GLContextImpl { hglrc = wglExt.wglCreateContextAttribsARB(drawable.getNativeWindow().getSurfaceHandle(), hglrc2, attribs, 0); if(0==hglrc) { if(DEBUG) { - System.err.println("WindowsWGLContext.createContext couldn't create >= 3.2 core context"); + System.err.println("WindowsWGLContext.createContext couldn't create >= 3.2 core context - fallback"); } // Try >= 3.1 forward compatible - last resort for GL3 ! attribs[0+1] = 3; @@ -201,6 +202,13 @@ public class WindowsWGLContext extends GLContextImpl { if(0==hglrc) { // 3.1 or 3.0 .. hglrc = wglExt.wglCreateContextAttribsARB(drawable.getNativeWindow().getSurfaceHandle(), hglrc2, attribs, 0); + if(DEBUG) { + if(0==hglrc) { + System.err.println("WindowsWGLContext.createContext couldn't create >= 3.0 context - fallback"); + } else { + System.err.println("WindowsWGLContext.createContext >= 3.0 available 0x"+Long.toHexString(hglrc)); + } + } } if(0==hglrc) { diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java index 126062d27..d5a5f3433 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java @@ -202,27 +202,30 @@ public abstract class X11GLXContext extends GLContextImpl { }; if(glCaps.getGLProfile().isGL3()) { - if(tryGLContext3_2) { - // Try >= 3.2 core first - // and verify with a None drawable binding (default framebuffer) - attribs[0+1] = 3; - attribs[2+1] = 2; - // FIXME: attribs[8+0] = GLX.GLX_CONTEXT_PROFILE_MASK_ARB; - // FIXME: attribs[8+1] = GLX.GLX_CONTEXT_CORE_PROFILE_BIT_ARB; - - context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0); - if(0!=context) { - if (!GLX.glXMakeContextCurrent(display, 0, 0, context)) { - if(DEBUG) { - System.err.println("X11GLXContext.createContext couldn't make >= 3.2 core context current - fallback"); - } - GLX.glXMakeContextCurrent(display, 0, 0, 0); - GLX.glXDestroyContext(display, context); - context = 0; - } else if(DEBUG) { - System.err.println("X11GLXContext.createContext >= 3.2 available 0x"+Long.toHexString(context)); + // Try >= 3.2 core first + // and verify with a None drawable binding (default framebuffer) + attribs[0+1] = 3; + attribs[2+1] = 2; + // FIXME NV Bug: attribs[8+0] = GLX.GLX_CONTEXT_PROFILE_MASK_ARB; + // FIXME NV Bug: attribs[8+1] = GLX.GLX_CONTEXT_CORE_PROFILE_BIT_ARB; + + context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0); + if(0!=context) { + if (!GLX.glXMakeContextCurrent(display, + drawable.getNativeWindow().getSurfaceHandle(), + drawable.getNativeWindow().getSurfaceHandle(), + context)) { + if(DEBUG) { + System.err.println("X11GLXContext.createContext couldn't make >= 3.2 core context current - fallback"); } + GLX.glXMakeContextCurrent(display, 0, 0, 0); + GLX.glXDestroyContext(display, context); + context = 0; } else if(DEBUG) { + System.err.println("X11GLXContext.createContext >= 3.2 available 0x"+Long.toHexString(context)); + } + } else { + if(DEBUG) { System.err.println("X11GLXContext.createContext couldn't create >= 3.2 core context - fallback"); } } @@ -238,6 +241,25 @@ public abstract class X11GLXContext extends GLContextImpl { if(0==context) { // 3.1 or 3.0 .. context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0); + if(0!=context) { + if (!GLX.glXMakeContextCurrent(display, + drawable.getNativeWindow().getSurfaceHandle(), + drawable.getNativeWindow().getSurfaceHandle(), + context)) { + if(DEBUG) { + System.err.println("X11GLXContext.createContext couldn't make >= 3.0 core context current - fallback"); + } + GLX.glXMakeContextCurrent(display, 0, 0, 0); + GLX.glXDestroyContext(display, context); + context = 0; + } else if(DEBUG) { + System.err.println("X11GLXContext.createContext >= 3.0 available 0x"+Long.toHexString(context)); + } + } else { + if(DEBUG) { + System.err.println("X11GLXContext.createContext couldn't create >= 3.0 core context - fallback"); + } + } } if(0==context) { @@ -253,22 +275,17 @@ public abstract class X11GLXContext extends GLContextImpl { drawable.getNativeWindow().getSurfaceHandle(), drawable.getNativeWindow().getSurfaceHandle(), context)) { + GLX.glXMakeContextCurrent(display, 0, 0, 0); + GLX.glXDestroyContext(display, temp_context); throw new GLException("Error making context (old) current: display 0x"+Long.toHexString(display)+", context 0x"+Long.toHexString(context)+", drawable "+drawable); } if(DEBUG) { System.err.println("X11GLXContext.createContext done (old ctx < 3.0 - no 3.0) 0x"+Long.toHexString(context)); } } else { - GLX.glXMakeContextCurrent(display, 0, 0, 0); GLX.glXDestroyContext(display, temp_context); // need to update the GL func table .. - if (!GLX.glXMakeContextCurrent(display, - drawable.getNativeWindow().getSurfaceHandle(), - drawable.getNativeWindow().getSurfaceHandle(), - context)) { - throw new GLException("Error making context (new) current: display 0x"+Long.toHexString(display)+", context 0x"+Long.toHexString(context)+", drawable "+drawable); - } updateGLProcAddressTable(); if(DEBUG) { System.err.println("X11GLXContext.createContext done (new ctx >= 3.0) 0x"+Long.toHexString(context)); -- cgit v1.2.3 From 6b0a0906617ddc5ccbbfe5b1eafb03be2e730a3d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 6 Aug 2009 00:46:30 -0700 Subject: Fix Offscreen/PBuffer [WGL/GLX]: No XVisual/PFD necessary here .. --- .../impl/windows/wgl/WindowsPbufferWGLDrawable.java | 8 +++++--- .../impl/x11/glx/X11GLXGraphicsConfiguration.java | 2 +- .../x11/glx/X11GLXGraphicsConfigurationFactory.java | 21 ++++++++++++--------- 3 files changed, 18 insertions(+), 13 deletions(-) (limited to 'src/jogl/classes/com') 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 79dda9049..20a891414 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 @@ -290,10 +290,12 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { GLCapabilities newCaps = WindowsWGLGraphicsConfiguration.AttribList2GLCapabilities(glProfile, iattributes, niattribs, ivalues, true, false, true); PIXELFORMATDESCRIPTOR pfd = WindowsWGLGraphicsConfiguration.createPixelFormatDescriptor(); if (WGL.DescribePixelFormat(parentHdc, pformats[whichFormat], pfd.size(), pfd) == 0) { - throw new GLException("Unable to describe pixel format " + pformats[whichFormat]); + if (DEBUG) { + System.err.println("Unable to describe pixel format (Continue: true) " + whichFormat + "/" + nformats + " pfdID " + pformats[whichFormat]+":\n\t"+newCaps); + } } if(newCaps.isOnscreen()) { - throw new GLException("Error: Selected Onscreen Caps for PBuffer: "+newCaps); + throw new GLException("Error: Selected Onscreen Caps for PBuffer: "+newCaps+"\n\t"+newCaps); } config.setCapsPFD(newCaps, pfd, pformats[whichFormat], true); } else { @@ -303,7 +305,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { } GLCapabilities newCaps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(glProfile, pfd, false, true); if(newCaps.isOnscreen()) { - throw new GLException("Error: Selected Onscreen Caps for PBuffer: "+newCaps); + throw new GLException("Error: Selected Onscreen Caps for PBuffer: "+newCaps+"\n\t"+newCaps); } config.setCapsPFD(newCaps, pfd, pformats[whichFormat], false); } diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java index 4cd174bec..dbf69e865 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java @@ -198,7 +198,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem String glXExtensions = GLX.glXQueryExtensionsString(display, screen); if (glXExtensions == null || glXExtensions.indexOf("GLX_NV_float_buffer") < 0) { - throw new GLException("Floating-point pbuffers on X11 currently require NVidia hardware"); + throw new GLException("Floating-point pbuffers on X11 currently require NVidia hardware: "+glXExtensions); } res[idx++] = GLXExt.GLX_FLOAT_COMPONENTS_NV; res[idx++] = GL.GL_TRUE; diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java index 49b56ea0e..074fbda5f 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java @@ -89,7 +89,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac xvis = X11GLXGraphicsConfiguration.XVisualID2XVisualInfo(display, visID); caps = X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(glProfile, display, xvis, onscreen, usePBuffer, isMultisampleAvailable); - int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(caps, true, isMultisampleAvailable, 0, 0); + int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(caps, true, isMultisampleAvailable, display, screen); int[] count = { -1 }; PointerBuffer fbcfgsL = GLX.glXChooseFBConfigCopied(display, screen, attribs, 0, count, 0); if (fbcfgsL == null || fbcfgsL.limit()<1) { @@ -186,19 +186,19 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac AbstractGraphicsDevice absDevice = x11Screen.getDevice(); long display = absDevice.getHandle(); boolean isMultisampleAvailable = GLXUtil.isMultisampleAvailable(display); - int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capabilities, true, isMultisampleAvailable, 0, 0); + int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capabilities, true, isMultisampleAvailable, display, screen); int[] count = { -1 }; fbcfgsL = GLX.glXChooseFBConfigCopied(display, screen, attribs, 0, count, 0); if (fbcfgsL == null || fbcfgsL.limit()<1) { if(DEBUG) { - System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: glXChooseFBConfig ("+x11Screen+","+capabilities+"): "+fbcfgsL+", "+count[0]); + System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed glXChooseFBConfig ("+x11Screen+","+capabilities+"): "+fbcfgsL+", "+count[0]); } return null; } if( !X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfgsL.get(0) ) ) { if(DEBUG) { - System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: GLX FBConfig invalid: ("+x11Screen+","+capabilities+"): "+fbcfgsL+", fbcfg: 0x"+Long.toHexString(fbcfgsL.get(0))); + System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed - GLX FBConfig invalid: ("+x11Screen+","+capabilities+"): "+fbcfgsL+", fbcfg: 0x"+Long.toHexString(fbcfgsL.get(0))); } return null; } @@ -224,7 +224,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac if (chosen < 0) { // keep on going .. if(DEBUG) { - System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig .. unable to choose config, using first"); + System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig Failed .. unable to choose config, using first"); } chosen = 0; // default .. } else if (chosen >= caps.length) { @@ -236,9 +236,12 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac retXVisualInfo = GLX.glXGetVisualFromFBConfigCopied(display, fbcfgsL.get(chosen)); if (retXVisualInfo==null) { if(DEBUG) { - System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: glXGetVisualFromFBConfig ("+x11Screen+", "+fbcfgsL.get(chosen) +": "+fbcfgsL); + System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed glXGetVisualFromFBConfig ("+x11Screen+", "+fbcfgsL.get(chosen) +" (Continue: "+(false==caps[chosen].isOnscreen())+"):\n\t"+caps[chosen]); + } + if(caps[chosen].isOnscreen()) { + // Onscreen drawables shall have a XVisual .. + return null; } - return null; } } finally { NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock(); @@ -271,7 +274,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac AbstractGraphicsDevice absDevice = x11Screen.getDevice(); long display = absDevice.getHandle(); boolean isMultisampleAvailable = GLXUtil.isMultisampleAvailable(display); - int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capabilities, false, isMultisampleAvailable, 0, 0); + int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capabilities, false, isMultisampleAvailable, display, screen); XVisualInfo[] infos = null; XVisualInfo recommendedVis = GLX.glXChooseVisualCopied(display, screen, attribs, 0); @@ -309,7 +312,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac if (chosen < 0) { // keep on going .. if(DEBUG) { - System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual .. unable to choose config, using first"); + System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual Failed .. unable to choose config, using first"); } chosen = 0; // default .. } else if (chosen >= caps.length) { -- cgit v1.2.3