summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-06-23 08:03:04 +0200
committerSven Gothel <[email protected]>2019-06-23 08:03:04 +0200
commitbba73bc096250a3c7fc036d84b1ea054d1b70b06 (patch)
treeed02575eac2a46bd49627444dcce972946ae8d2e /src/jogl/classes/com/jogamp
parent154e91978498d8b6db9ce34a1f06b298bcf4c361 (diff)
iOS: Initial working commit supporting iOS (ipad pro 11)
using our OpenJFK 9 x86_64 and arm64 build. Test demo class is 'com.jogamp.opengl.demos.ios.Hello', residing in the new demo folder 'src/demos/com/jogamp/opengl/demos/ios/Hello.java'. This commit does not yet include a working NEWT specialization for iOS, but it shall followup soon. Instead this commit demonstrates JOGL operating on native UIWindow, UIView and CAEAGLLayer as provided by Nativewindow's IOSUtil. Test Video https://www.youtube.com/watch?v=Z4lUQNFTGMI +++ Notable bug: The FBO used and sharing the COLORBUFFER RENDERBUFFER memory resources with CAEAGLLayer to be displayed in the UIView seemingly cannot handle GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24 or GL_DEPTH_COMPONENT32 depth buffer - none at all (Device + Simulation). Therefor the default demo GLEventListener chosen here don't require a depth buffer ;-) This issue can hopefully be mitigated with other means than using a flat FBO sink similar to FBO multisampling.
Diffstat (limited to 'src/jogl/classes/com/jogamp')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/FBObject.java48
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLDrawableFactory.java83
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLProfile.java178
-rw-r--r--src/jogl/classes/com/jogamp/opengl/JoglVersion.java13
4 files changed, 219 insertions, 103 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java
index c36727fe4..00a560fc7 100644
--- a/src/jogl/classes/com/jogamp/opengl/FBObject.java
+++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java
@@ -34,7 +34,6 @@ import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GL2ES3;
import com.jogamp.opengl.GL2GL3;
-import com.jogamp.opengl.GL3;
import com.jogamp.opengl.GLBase;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLCapabilitiesImmutable;
@@ -43,6 +42,7 @@ import com.jogamp.opengl.GLException;
import com.jogamp.opengl.GLProfile;
import jogamp.opengl.Debug;
+import jogamp.opengl.ios.eagl.EAGL;
import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.PropertyAccess;
@@ -483,6 +483,48 @@ public class FBObject {
@Override
public final ColorAttachment getColorAttachment() { return this; }
+ @Override
+ public boolean initialize(final GL gl) throws GLException {
+ final boolean init = 0 == getName();
+ if( init ) {
+ final boolean checkError = DEBUG || GLContext.DEBUG_GL;
+ if( checkError ) {
+ checkPreGLError(gl);
+ }
+ final int[] name = new int[] { -1 };
+ gl.glGenRenderbuffers(1, name, 0);
+ setName(name[0]);
+
+ gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, getName());
+ if( getSamples() > 0 ) {
+ ((GL2ES3)gl).glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, getSamples(), format, getWidth(), getHeight());
+ } else {
+ // FIXME: Need better way to inject the IOS EAGL Layer into FBObject
+ // FIXME: May want to implement optional injection of a BufferStorage SPI?
+ final GLContext ctx = gl.getContext();
+ final Long iosEAGLLayer = (Long) ctx.getAttachedObject("IOS_EAGL_LAYER");
+ if( null != iosEAGLLayer ) {
+ EAGL.eaglBindDrawableStorageToRenderbuffer(gl.getContext().contextHandle, GL.GL_RENDERBUFFER, iosEAGLLayer.longValue());
+ } else {
+ gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, format, getWidth(), getHeight());
+ }
+ }
+ if( checkError ) {
+ final int glerr = gl.glGetError();
+ if(GL.GL_NO_ERROR != glerr) {
+ gl.glDeleteRenderbuffers(1, name, 0);
+ setName(0);
+ throw new GLException("GL Error "+toHexString(glerr)+" while creating "+this);
+ }
+ }
+ if(DEBUG) {
+ System.err.println("Attachment.init.X: "+this);
+ }
+ }
+ return init;
+ }
+
+
}
/** Texture FBO attachment */
@@ -1250,7 +1292,7 @@ public class FBObject {
return("FBO missing read buffer");
case GL.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
return("FBO missing multisample buffer");
- case GL3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:
+ case GL3ES3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:
return("FBO missing layer targets");
case GL.GL_FRAMEBUFFER_UNSUPPORTED:
@@ -1281,7 +1323,7 @@ public class FBObject {
case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
case GL.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
- case GL3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:
+ case GL3ES3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:
if(0 == colorbufferCount || null == depth) {
// we are in transition
return true;
diff --git a/src/jogl/classes/com/jogamp/opengl/GLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/GLDrawableFactory.java
index 51da34ce0..1fe42a332 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLDrawableFactory.java
@@ -43,6 +43,7 @@ package com.jogamp.opengl;
import java.util.ArrayList;
import java.util.List;
+import com.jogamp.common.os.Platform;
import com.jogamp.common.util.PropertyAccess;
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.opengl.GLAutoDrawableDelegate;
@@ -57,6 +58,7 @@ import com.jogamp.nativewindow.NativeWindowFactory;
import com.jogamp.nativewindow.ProxySurface;
import com.jogamp.nativewindow.UpstreamSurfaceHook;
+import jogamp.common.os.PlatformPropsImpl;
import jogamp.opengl.Debug;
/** <p> Provides a virtual machine- and operating system-independent
@@ -137,6 +139,8 @@ public abstract class GLDrawableFactory {
factoryClassName = "jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory";
} else if ( nwt == NativeWindowFactory.TYPE_MACOSX ) {
factoryClassName = "jogamp.opengl.macosx.cgl.MacOSXCGLDrawableFactory";
+ } else if ( nwt == NativeWindowFactory.TYPE_IOS ) {
+ factoryClassName = "jogamp.opengl.ios.eagl.IOSEAGLDrawableFactory";
} else {
// may use egl*Factory ..
if (DEBUG || GLProfile.DEBUG) {
@@ -144,7 +148,7 @@ public abstract class GLDrawableFactory {
}
}
}
- if ( !GLProfile.disableOpenGLDesktop ) {
+ if ( !GLProfile.disableOpenGLDesktop || GLProfile.disabledEGL ) {
if ( null != factoryClassName ) {
if (DEBUG || GLProfile.DEBUG) {
System.err.println("GLDrawableFactory.static - Native OS Factory for: "+nwt+": "+factoryClassName);
@@ -168,7 +172,7 @@ public abstract class GLDrawableFactory {
System.err.println("Info: GLDrawableFactory.static - Desktop GLDrawableFactory - disabled!");
}
- if(!GLProfile.disableOpenGLES) {
+ if(!GLProfile.disableOpenGLES && !GLProfile.disabledEGL) {
try {
tmp = (GLDrawableFactory) ReflectionUtil.createInstance("jogamp.opengl.egl.EGLDrawableFactory", cl);
} catch (final Exception jre) {
@@ -434,6 +438,15 @@ public abstract class GLDrawableFactory {
/**
* Returns the sole GLDrawableFactory instance for the desktop (X11, WGL, ..) if exist or null
+ * <p>
+ * To fetch the appropriate {@link GLDrawableFactory} for native desktop
+ * or mobile, use {@link #getFactory(boolean)}.
+ * </p>
+ * <p>
+ * It is possible that the desktop {@link GLDrawableFactory} will be used for
+ * native mobile GL profiles, e.g. {@link Platform.OSType#IOS}.
+ * </p>
+ * @return the matching {@link GLDrawableFactory} or {@code null} if none is available
*/
public static GLDrawableFactory getDesktopFactory() {
GLProfile.initSingleton();
@@ -441,7 +454,16 @@ public abstract class GLDrawableFactory {
}
/**
- * Returns the sole GLDrawableFactory instance for EGL if exist or null
+ * Returns the sole {@link GLDrawableFactory} instance for EGL if exist or null.
+ * <p>
+ * To fetch the appropriate {@link GLDrawableFactory} for native desktop
+ * or mobile, use {@link #getFactory(boolean)}.
+ * </p>
+ * <p>
+ * It is possible that a non EGL {@link GLDrawableFactory} will be used for
+ * native mobile GL profiles, e.g. {@link Platform.OSType#IOS}.
+ * </p>
+ * @return the matching {@link GLDrawableFactory} or {@code null} if none is available
*/
public static GLDrawableFactory getEGLFactory() {
GLProfile.initSingleton();
@@ -449,34 +471,61 @@ public abstract class GLDrawableFactory {
}
/**
- * Returns the sole GLDrawableFactory instance.
+ * Returns the sole {@link GLDrawableFactory} instance.
*
- * @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.
+ * @param glProfile GLProfile to determine the factory type, ie for native mobile GL or native desktop GL.
+ * @return the matching {@link GLDrawableFactory}
+ * @throws GLException if no matching {@link GLDrawableFactory} exists
*/
public static GLDrawableFactory getFactory(final GLProfile glProfile) throws GLException {
- return getFactoryImpl(glProfile.getImplName());
+ final GLDrawableFactory f = getFactoryImpl(glProfile.getImplName());
+ if( null != f ) {
+ return f;
+ }
+ throw new GLException("No GLDrawableFactory available for profile: "+glProfile);
}
-
- protected static GLDrawableFactory getFactoryImpl(final String glProfileImplName) throws GLException {
- if ( GLProfile.usesNativeGLES(glProfileImplName) ) {
- if(null!=eglFactory) {
+ /**
+ * Returns the sole {@link GLDrawableFactory} instance, either for mobile if {@code usesNativeGLES} is true,
+ * or for desktop otherwise.
+ * @param useNativeGLES request native mobile GLES support if true
+ * @return the matching {@link GLDrawableFactory} or {@code null} if none is available
+ */
+ public static GLDrawableFactory getFactory(final boolean useNativeGLES) {
+ GLProfile.initSingleton();
+ return getFactoryImpl( useNativeGLES );
+ }
+ protected static GLDrawableFactory getFactoryImpl(final String glProfileImplName) {
+ return getFactoryImpl( GLProfile.usesNativeGLES(glProfileImplName) );
+ }
+ protected static GLDrawableFactory getFactoryImpl(final boolean useNativeGLES) {
+ if( useNativeGLES ) {
+ if(null!=eglFactory && eglFactory.hasOpenGLESSupport() ) {
return eglFactory;
}
- } else if(null!=nativeOSFactory) {
- return nativeOSFactory;
+ if(null!=nativeOSFactory && nativeOSFactory.hasOpenGLESSupport() ) {
+ return nativeOSFactory;
+ }
+ } else {
+ if(null!=nativeOSFactory && nativeOSFactory.hasOpenGLDesktopSupport() ) {
+ return nativeOSFactory;
+ }
}
- throw new GLException("No GLDrawableFactory available for profile: "+glProfileImplName);
+ return null;
}
-
- protected static GLDrawableFactory getFactoryImpl(final AbstractGraphicsDevice device) throws GLException {
+ /**
+ * Returns the sole {@link GLDrawableFactory} matching the given {@link AbstractGraphicsDevice} instance,
+ * which will be suitable either for native mobile or native desktop.
+ * @param device the queries {@link AbstractGraphicsDevice} seeking for its matching factory
+ * @return the matching {@link GLDrawableFactory} or {@code null} if none is available
+ */
+ public static GLDrawableFactory getFactory(final AbstractGraphicsDevice device) {
if(null != nativeOSFactory && nativeOSFactory.getIsDeviceCompatible(device)) {
return nativeOSFactory;
}
if(null != eglFactory && eglFactory.getIsDeviceCompatible(device)) {
return eglFactory;
}
- throw new GLException("No native platform GLDrawableFactory, nor EGLDrawableFactory available: "+device);
+ return null;
}
/**
diff --git a/src/jogl/classes/com/jogamp/opengl/GLProfile.java b/src/jogl/classes/com/jogamp/opengl/GLProfile.java
index e19535e5d..0e0d45444 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLProfile.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLProfile.java
@@ -86,7 +86,7 @@ public class GLProfile {
* and if one platform may have a buggy implementation,
* setting the property <code>jogl.disable.openglcore</code> disables querying possible existing native OpenGL core profiles.
* <p>
- * This exclusion is disabled for {@link Platform.OSType#MACOS}.
+ * This exclusion is disabled for {@link Platform.OSType#MACOS} and {@link Platform.OSType#IOS}.
* </p>
*/
public static final boolean disableOpenGLCore;
@@ -99,7 +99,7 @@ public class GLProfile {
* This exclusion also disables {@link #disableOpenGLES OpenGL ES}.
* </p>
* <p>
- * This exclusion is disabled for {@link Platform.OSType#MACOS}.
+ * This exclusion is disabled for {@link Platform.OSType#MACOS} and {@link Platform.OSType#IOS}.
* </p>
*/
public static final boolean disableOpenGLARBContext;
@@ -119,6 +119,13 @@ public class GLProfile {
public static final boolean disableOpenGLDesktop;
/**
+ * In case no EGL implementation is available
+ * like on the {@link Platform.OSType#IOS} platform,
+ * this is set to {@code true}.
+ */
+ public static final boolean disabledEGL;
+
+ /**
* Disable surfaceless OpenGL context capability and its probing
* by setting the property <code>jogl.disable.surfacelesscontext</code>.
* <p>
@@ -145,11 +152,13 @@ public class GLProfile {
static {
// Also initializes TempJarCache if shall be used.
Platform.initSingleton();
- final boolean isOSX = Platform.OSType.MACOS == Platform.getOSType();
+ final boolean isIOS = Platform.OSType.IOS == Platform.getOSType();
+ final boolean isOSXorIOS = Platform.OSType.MACOS == Platform.getOSType() || isIOS;
DEBUG = Debug.debug("GLProfile");
- disableOpenGLCore = PropertyAccess.isPropertyDefined("jogl.disable.openglcore", true) && !isOSX;
- disableOpenGLARBContext = PropertyAccess.isPropertyDefined("jogl.disable.openglarbcontext", true) && !isOSX;
+ disabledEGL = isIOS;
+ disableOpenGLCore = PropertyAccess.isPropertyDefined("jogl.disable.openglcore", true) && !isOSXorIOS;
+ disableOpenGLARBContext = PropertyAccess.isPropertyDefined("jogl.disable.openglarbcontext", true) && !isOSXorIOS;
disableOpenGLES = disableOpenGLARBContext || PropertyAccess.isPropertyDefined("jogl.disable.opengles", true);
disableOpenGLDesktop = PropertyAccess.isPropertyDefined("jogl.disable.opengldesktop", true);
disableSurfacelessContext = PropertyAccess.isPropertyDefined("jogl.disable.surfacelesscontext", true);
@@ -243,7 +252,7 @@ public class GLProfile {
initLock.unlock();
}
if(DEBUG) {
- if( justInitialized && ( hasGL234Impl || hasGL234OnEGLImpl || hasGLES1Impl || hasGLES3Impl ) ) {
+ if( justInitialized && ( hasGL234Impl || hasGL234OnMobileImpl || hasGLES1Impl || hasGLES3Impl ) ) {
System.err.println(JoglVersion.getDefaultOpenGLInfo(defaultDevice, null, true));
}
}
@@ -671,6 +680,18 @@ public class GLProfile {
public static final String[] GL_PROFILE_LIST_MIN_DESKTOP = new String[] { GL2, GL3bc, GL4bc, GL3, GL4 };
/**
+ * Order of maximum original mobile profiles.
+ *
+ * <ul>
+ * <li> GLES3 </li>
+ * <li> GLES2 </li>
+ * <li> GLES1 </li>
+ * </ul>
+ *
+ */
+ public static final String[] GL_PROFILE_LIST_MAX_MOBILE = new String[] { GLES3, GLES2, GLES1 };
+
+ /**
* Order of maximum fixed function profiles
*
* <ul>
@@ -1627,10 +1648,10 @@ public class GLProfile {
private static /*final*/ boolean hasDesktopGLFactory;
private static /*final*/ boolean hasGL234Impl;
- private static /*final*/ boolean hasEGLFactory;
+ private static /*final*/ boolean hasMobileFactory;
private static /*final*/ boolean hasGLES3Impl;
private static /*final*/ boolean hasGLES1Impl;
- private static /*final*/ boolean hasGL234OnEGLImpl;
+ private static /*final*/ boolean hasGL234OnMobileImpl;
private static /*final*/ Constructor<?> ctorGL234Impl;
private static /*final*/ Constructor<?> ctorGLES3Impl;
private static /*final*/ Constructor<?> ctorGLES1Impl;
@@ -1638,7 +1659,7 @@ public class GLProfile {
private static /*final*/ Constructor<?> ctorGLES3ProcAddr;
private static /*final*/ Constructor<?> ctorGLES1ProcAddr;
- private static /*final*/ GLDrawableFactoryImpl eglFactory = null;
+ private static /*final*/ GLDrawableFactoryImpl mobileFactory = null;
private static /*final*/ GLDrawableFactoryImpl desktopFactory = null;
private static /*final*/ AbstractGraphicsDevice defaultDevice = null;
@@ -1683,7 +1704,7 @@ public class GLProfile {
ctorGL234ProcAddr = null;
}
}
- hasGL234OnEGLImpl = hasGL234Impl;
+ hasGL234OnMobileImpl = hasGL234Impl;
// depends on hasEGLFactory
{
@@ -1748,7 +1769,7 @@ public class GLProfile {
try {
desktopFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getFactoryImpl(GL2);
if(null != desktopFactory) {
- final DesktopGLDynamicLookupHelper glLookupHelper = (DesktopGLDynamicLookupHelper) desktopFactory.getGLDynamicLookupHelper(2, GLContext.CTX_PROFILE_COMPAT);
+ final GLDynamicLookupHelper glLookupHelper = desktopFactory.getGLDynamicLookupHelper(2, GLContext.CTX_PROFILE_COMPAT);
hasGL234Impl = null!=glLookupHelper && glLookupHelper.isLibComplete() && hasGL234Impl;
hasDesktopGLFactory = hasGL234Impl;
}
@@ -1777,48 +1798,46 @@ public class GLProfile {
defaultDesktopDevice = desktopFactory.getDefaultDevice();
}
- if ( ReflectionUtil.isClassAvailable("jogamp.opengl.egl.EGLDrawableFactory", classloader) ) {
- t=null;
- try {
- eglFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getFactoryImpl(GLES2);
- if(null != eglFactory) {
- // update hasGLES1Impl, hasGLES3Impl, hasGL234OnEGLImpl based on library completion
- final GLDynamicLookupHelper es2DynLookup = eglFactory.getGLDynamicLookupHelper(2, GLContext.CTX_PROFILE_ES);
- final GLDynamicLookupHelper es1DynLookup = eglFactory.getGLDynamicLookupHelper(1, GLContext.CTX_PROFILE_ES);
- final GLDynamicLookupHelper glXDynLookup = eglFactory.getGLDynamicLookupHelper(3, GLContext.CTX_PROFILE_CORE);
- hasGLES3Impl = null!=es2DynLookup && es2DynLookup.isLibComplete() && hasGLES3Impl;
- hasGLES1Impl = null!=es1DynLookup && es1DynLookup.isLibComplete() && hasGLES1Impl;
- hasGL234OnEGLImpl = null!=glXDynLookup && glXDynLookup.isLibComplete() && hasGL234OnEGLImpl;
- hasEGLFactory = hasGLES3Impl || hasGLES1Impl || hasGL234OnEGLImpl;
- }
- } catch (final LinkageError le) {
- t=le;
- } catch (final SecurityException se) {
- t=se;
- } catch (final NullPointerException npe) {
- t=npe;
- } catch (final RuntimeException re) {
- t=re;
+ t=null;
+ try {
+ mobileFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getFactoryImpl(GLES2);
+ if(null != mobileFactory) {
+ // update hasGLES1Impl, hasGLES3Impl, hasGL234OnEGLImpl based on library completion
+ final GLDynamicLookupHelper es2DynLookup = mobileFactory.getGLDynamicLookupHelper(2, GLContext.CTX_PROFILE_ES);
+ final GLDynamicLookupHelper es1DynLookup = mobileFactory.getGLDynamicLookupHelper(1, GLContext.CTX_PROFILE_ES);
+ final GLDynamicLookupHelper glXDynLookup = mobileFactory.getGLDynamicLookupHelper(3, GLContext.CTX_PROFILE_CORE);
+ hasGLES3Impl = null!=es2DynLookup && es2DynLookup.isLibComplete() && hasGLES3Impl;
+ hasGLES1Impl = null!=es1DynLookup && es1DynLookup.isLibComplete() && hasGLES1Impl;
+ hasGL234OnMobileImpl = null!=glXDynLookup && glXDynLookup.isLibComplete() && hasGL234OnMobileImpl;
+ hasMobileFactory = hasGLES3Impl || hasGLES1Impl || hasGL234OnMobileImpl;
}
- if(DEBUG) {
- if(null!=t) {
- t.printStackTrace();
- }
+ } catch (final LinkageError le) {
+ t=le;
+ } catch (final SecurityException se) {
+ t=se;
+ } catch (final NullPointerException npe) {
+ t=npe;
+ } catch (final RuntimeException re) {
+ t=re;
+ }
+ if(DEBUG) {
+ if(null!=t) {
+ t.printStackTrace();
}
}
- final AbstractGraphicsDevice defaultEGLDevice;
- if(null == eglFactory) {
- hasEGLFactory = false;
- hasGL234OnEGLImpl= false;
+ final AbstractGraphicsDevice defaultMobileDevice;
+ if(null == mobileFactory) {
+ hasMobileFactory = false;
+ hasGL234OnMobileImpl= false;
hasGLES3Impl = false;
hasGLES1Impl = false;
- defaultEGLDevice = null;
+ defaultMobileDevice = null;
if(DEBUG) {
- System.err.println("Info: GLProfile.init - EGL GLDrawable factory not available");
+ System.err.println("Info: GLProfile.init - Mobile GLDrawable factory not available");
}
} else {
- defaultEGLDevice = eglFactory.getDefaultDevice();
+ defaultMobileDevice = mobileFactory.getDefaultDevice();
}
if( null != defaultDesktopDevice ) {
@@ -1826,10 +1845,10 @@ public class GLProfile {
if(DEBUG) {
System.err.println("Info: GLProfile.init - Default device is desktop derived: "+defaultDevice);
}
- } else if ( null != defaultEGLDevice ) {
- defaultDevice = defaultEGLDevice;
+ } else if ( null != defaultMobileDevice ) {
+ defaultDevice = defaultMobileDevice;
if(DEBUG) {
- System.err.println("Info: GLProfile.init - Default device is EGL derived: "+defaultDevice);
+ System.err.println("Info: GLProfile.init - Default device is mobile derived: "+defaultDevice);
}
} else {
if(DEBUG) {
@@ -1839,22 +1858,22 @@ public class GLProfile {
}
// we require to initialize the EGL device 1st, if available
- final boolean addedEGLProfile = null != defaultEGLDevice ? initProfilesForDevice(defaultEGLDevice) : false;
+ final boolean addedMobileProfile = null != defaultMobileDevice ? initProfilesForDevice(defaultMobileDevice) : false;
final boolean addedDesktopProfile = null != defaultDesktopDevice ? initProfilesForDevice(defaultDesktopDevice) : false;
- final boolean addedAnyProfile = addedEGLProfile || addedDesktopProfile ;
+ final boolean addedAnyProfile = addedMobileProfile || addedDesktopProfile ;
if(DEBUG) {
- System.err.println("GLProfile.init addedAnyProfile "+addedAnyProfile+" (desktop: "+addedDesktopProfile+", egl "+addedEGLProfile+")");
+ System.err.println("GLProfile.init addedAnyProfile "+addedAnyProfile+" (desktop: "+addedDesktopProfile+", mobile "+addedMobileProfile+")");
System.err.println("GLProfile.init isAWTAvailable "+isAWTAvailable);
System.err.println("GLProfile.init hasDesktopGLFactory "+hasDesktopGLFactory);
System.err.println("GLProfile.init hasGL234Impl "+hasGL234Impl);
- System.err.println("GLProfile.init hasEGLFactory "+hasEGLFactory);
+ System.err.println("GLProfile.init hasMobileFactory "+hasMobileFactory);
System.err.println("GLProfile.init hasGLES1Impl "+hasGLES1Impl);
System.err.println("GLProfile.init hasGLES3Impl "+hasGLES3Impl);
- System.err.println("GLProfile.init hasGL234OnEGLImpl "+hasGL234OnEGLImpl);
+ System.err.println("GLProfile.init hasGL234OnEGLImpl "+hasGL234OnMobileImpl);
System.err.println("GLProfile.init defaultDevice "+defaultDevice);
System.err.println("GLProfile.init defaultDevice Desktop "+defaultDesktopDevice);
- System.err.println("GLProfile.init defaultDevice EGL "+defaultEGLDevice);
+ System.err.println("GLProfile.init defaultDevice Mobile "+defaultMobileDevice);
System.err.println("GLProfile.init profile order "+array2String(GL_PROFILE_LIST_ALL));
}
}
@@ -1869,22 +1888,25 @@ public class GLProfile {
}
initLock.lock();
try {
- final GLDrawableFactory factory = GLDrawableFactory.getFactoryImpl(device);
- factory.enterThreadCriticalZone();
- try {
- return initProfilesForDeviceCritical(device);
- } finally {
- factory.leaveThreadCriticalZone();
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(device);
+ if( null != factory ) {
+ factory.enterThreadCriticalZone();
+ try {
+ return initProfilesForDeviceCritical(device);
+ } finally {
+ factory.leaveThreadCriticalZone();
+ }
}
} finally {
initLock.unlock();
}
+ return false;
}
private static boolean initProfilesForDeviceCritical(final AbstractGraphicsDevice device) {
final boolean isSet = GLContext.getAvailableGLVersionsSet(device);
if(DEBUG) {
- System.err.println("Info: GLProfile.initProfilesForDevice: "+device+" ("+device.getClass().getName()+"), isSet "+isSet+", hasDesktopGLFactory "+hasDesktopGLFactory+", hasEGLFactory "+hasEGLFactory);
+ System.err.println("Info: GLProfile.initProfilesForDevice: "+device+" ("+device.getClass().getName()+"), isSet "+isSet+", hasDesktopGLFactory "+hasDesktopGLFactory+", hasEGLFactory "+hasMobileFactory);
}
if(isSet) {
// Avoid recursion and check whether impl. is sane!
@@ -1899,7 +1921,7 @@ public class GLProfile {
HashMap<String, GLProfile> mappedDesktopProfiles = null;
boolean addedDesktopProfile = false;
HashMap<String, GLProfile> mappedEGLProfiles = null;
- boolean addedEGLProfile = false;
+ boolean addedMobileProfile = false;
final boolean deviceIsDesktopCompatible = hasDesktopGLFactory && desktopFactory.getIsDeviceCompatible(device);
@@ -1930,20 +1952,20 @@ public class GLProfile {
}
}
- final boolean deviceIsEGLCompatible = hasEGLFactory && eglFactory.getIsDeviceCompatible(device);
+ final boolean deviceIsMobileCompatible = hasMobileFactory && mobileFactory.getIsDeviceCompatible(device);
// also test GLES1, GLES2 and GLES3 on desktop, since we have implementations / emulations available.
- if( deviceIsEGLCompatible ) {
+ if( deviceIsMobileCompatible ) {
// 1st pretend we have all EGL profiles ..
computeProfileMap(device, true /* desktopCtxUndef*/, true /* esCtxUndef */);
// Triggers eager initialization of share context in GLDrawableFactory for the device,
// hence querying all available GLProfiles
- final Thread sharedResourceThread = eglFactory.getSharedResourceThread();
+ final Thread sharedResourceThread = mobileFactory.getSharedResourceThread();
if(null != sharedResourceThread) {
initLock.addOwner(sharedResourceThread);
}
- final boolean eglSharedCtxAvail = eglFactory.createSharedResource(device);
+ final boolean eglSharedCtxAvail = mobileFactory.createSharedResource(device);
if(null != sharedResourceThread) {
initLock.removeOwner(sharedResourceThread);
}
@@ -1952,28 +1974,28 @@ public class GLProfile {
throw new InternalError("Available GLVersions not set for "+device);
}
mappedEGLProfiles = computeProfileMap(device, false /* desktopCtxUndef*/, false /* esCtxUndef */);
- addedEGLProfile = mappedEGLProfiles.size() > 0;
+ addedMobileProfile = mappedEGLProfiles.size() > 0;
}
if (DEBUG) {
- System.err.println("GLProfile.initProfilesForDevice: "+device+": egl Shared Ctx "+eglSharedCtxAvail+
- ", profiles: "+(addedEGLProfile ? mappedEGLProfiles.size() : 0));
+ System.err.println("GLProfile.initProfilesForDevice: "+device+": mobile Shared Ctx "+eglSharedCtxAvail+
+ ", profiles: "+(addedMobileProfile ? mappedEGLProfiles.size() : 0));
}
}
- if( !addedDesktopProfile && !addedEGLProfile ) {
+ if( !addedDesktopProfile && !addedMobileProfile ) {
setProfileMap(device, new HashMap<String /*GLProfile_name*/, GLProfile>()); // empty
if(DEBUG) {
System.err.println("GLProfile: device could not be initialized: "+device);
System.err.println("GLProfile: compatible w/ desktop: "+deviceIsDesktopCompatible+
- ", egl "+deviceIsEGLCompatible);
+ ", mobile "+deviceIsMobileCompatible);
System.err.println("GLProfile: desktoplFactory "+desktopFactory);
- System.err.println("GLProfile: eglFactory "+eglFactory);
+ System.err.println("GLProfile: mobileFactory "+mobileFactory);
System.err.println("GLProfile: hasGLES1Impl "+hasGLES1Impl);
System.err.println("GLProfile: hasGLES3Impl "+hasGLES3Impl);
}
} else {
final HashMap<String, GLProfile> mappedAllProfiles = new HashMap<String, GLProfile>();
- if( addedEGLProfile ) {
+ if( addedMobileProfile ) {
mappedAllProfiles.putAll(mappedEGLProfiles);
}
if( addedDesktopProfile ) {
@@ -1985,7 +2007,7 @@ public class GLProfile {
GLContext.setAvailableGLVersionsSet(device, true);
if (DEBUG) {
- System.err.println("GLProfile.initProfilesForDevice: "+device.getUniqueID()+": added profile(s): desktop "+addedDesktopProfile+", egl "+addedEGLProfile);
+ System.err.println("GLProfile.initProfilesForDevice: "+device.getUniqueID()+": added profile(s): desktop "+addedDesktopProfile+", mobile "+addedMobileProfile);
System.err.println("GLProfile.initProfilesForDevice: "+device.getUniqueID()+": "+glAvailabilityToString(device));
if(addedDesktopProfile) {
dumpGLInfo(desktopFactory, device);
@@ -1993,16 +2015,16 @@ public class GLProfile {
for(int i=0; i<availCaps.size(); i++) {
System.err.println(availCaps.get(i));
}
- } else if(addedEGLProfile) {
- dumpGLInfo(eglFactory, device);
- final List<GLCapabilitiesImmutable> availCaps = eglFactory.getAvailableCapabilities(device);
+ } else if(addedMobileProfile) {
+ dumpGLInfo(mobileFactory, device);
+ final List<GLCapabilitiesImmutable> availCaps = mobileFactory.getAvailableCapabilities(device);
for(int i=0; i<availCaps.size(); i++) {
System.err.println(availCaps.get(i));
}
}
}
- return addedDesktopProfile || addedEGLProfile;
+ return addedDesktopProfile || addedMobileProfile;
}
private static void dumpGLInfo(final GLDrawableFactoryImpl factory, final AbstractGraphicsDevice device) {
@@ -2106,7 +2128,7 @@ public class GLProfile {
* Returns the profile implementation
*/
private static String computeProfileImpl(final AbstractGraphicsDevice device, final String profile, final boolean desktopCtxUndef, final boolean esCtxUndef, final boolean isHardwareRasterizer[]) {
- final boolean hasAnyGL234Impl = hasGL234Impl || hasGL234OnEGLImpl;
+ final boolean hasAnyGL234Impl = hasGL234Impl || hasGL234OnMobileImpl;
final boolean hardwareRasterizer[] = new boolean[1];
if ( GL2ES1 == profile ) {
final boolean gles1Available;
diff --git a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
index 560d99025..92511dc11 100644
--- a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
+++ b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
@@ -69,11 +69,12 @@ public class JoglVersion extends JogampVersion {
return toString(gl, null).toString();
}
- public static StringBuilder getAvailableCapabilitiesInfo(final GLDrawableFactory factory, final AbstractGraphicsDevice device, StringBuilder sb) {
+ public static StringBuilder getAvailableCapabilitiesInfo(final AbstractGraphicsDevice device, StringBuilder sb) {
if(null==sb) {
sb = new StringBuilder();
}
boolean done = false;
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(device);
if(null!=factory) {
try {
final List<GLCapabilitiesImmutable> availCaps = factory.getAvailableCapabilities(device);
@@ -100,10 +101,12 @@ public class JoglVersion extends JogampVersion {
device = GLProfile.getDefaultDevice();
}
sb.append(Platform.getNewline()).append(Platform.getNewline());
- sb.append("Desktop Capabilities: ").append(Platform.getNewline());
- getAvailableCapabilitiesInfo(GLDrawableFactory.getDesktopFactory(), device, sb);
- sb.append("EGL Capabilities: ").append(Platform.getNewline());
- getAvailableCapabilitiesInfo(GLDrawableFactory.getEGLFactory(), device, sb);
+ try {
+ sb.append("Capabilities for ").append(device.toString()).append(Platform.getNewline());
+ getAvailableCapabilitiesInfo(device, sb);
+ } catch (final GLException gle) {
+ System.err.println(gle.getMessage());
+ }
return sb;
}