diff options
author | Sven Gothel <[email protected]> | 2011-07-07 03:39:43 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-07-07 03:39:43 +0200 |
commit | 29cc5fa0375026c09bcbfed16627fe9eb6c97846 (patch) | |
tree | aefd65d00e5e9a6fa4e28a54f090737d65d37f09 | |
parent | c9903cf9d4ceda09ec07ef340f8aa3d0a104e23a (diff) |
GLProfile: Initialization fix and clarifications ( GLExceptions on n/a profiles )
- GLProfile.initSingleton(boolean) (implicit or explicit) won't
throw any exception anymore. Followup 'GLProfile GLProfile.get(..)'
calls will throw a GLException, if n/a.
Availability maybe queried via GLProfile.isAvailable(..).
- GLCapabilties, GLCanvas, GLJPanel: Clarify case where GLException maybe thrown,
i.e. no default GLProfile available on default device.
- Remove redundant GLProfile.is<ProfileName>Available(..)
6 files changed, 164 insertions, 173 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/javax/media/opengl/GLCapabilities.java index 1ae9e40aa..b63124e33 100644 --- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java +++ b/src/jogl/classes/javax/media/opengl/GLCapabilities.java @@ -79,8 +79,9 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil /** Creates a GLCapabilities object. All attributes are in a default state. * @param glp GLProfile, or null for the default GLProfile + * @throws GLException if no profile is given and no default profile is available for the default device. */ - public GLCapabilities(GLProfile glp) { + public GLCapabilities(GLProfile glp) throws GLException { glProfile = (null!=glp)?glp:GLProfile.getDefault(GLProfile.getDefaultDevice()); } diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 1921d117b..af652fe0b 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -98,11 +98,6 @@ public class GLProfile { * hence without the possibility to enable native multithreading.<br> * This is not the recommended way, since it may has a performance impact, but it allows you to run code without explicit initialization.</P> * <P> - * In case no explicit initialization was invoked and the implicit initialization didn't happen,<br> - * you may encounter the following exception: - * <pre> - * javax.media.opengl.GLException: No default profile available - * </pre></P> * * @param firstUIActionOnProcess Should be <code>true</code> if called before the first UI action of the running program, * otherwise <code>false</code>. @@ -124,8 +119,10 @@ public class GLProfile { /** * Trigger eager initialization of GLProfiles for the given device, * in case it isn't done yet. + * + * @throws GLException if no profile for the given device is available. */ - public static void initProfiles(AbstractGraphicsDevice device) { + public static void initProfiles(AbstractGraphicsDevice device) throws GLException { getProfileMap(device); } @@ -147,87 +144,42 @@ public class GLProfile { // Query platform available OpenGL implementation // - public static boolean isGL4bcAvailable(AbstractGraphicsDevice device) { - return null != getProfileMap(device).get(GL4bc); - } - - public static boolean isGL4Available(AbstractGraphicsDevice device) { - return null != getProfileMap(device).get(GL4); - } - - public static boolean isGL3bcAvailable(AbstractGraphicsDevice device) { - return null != getProfileMap(device).get(GL3bc); - } - - public static boolean isGL3Available(AbstractGraphicsDevice device) { - return null != getProfileMap(device).get(GL3); - } - - public static boolean isGL2Available(AbstractGraphicsDevice device) { - return null != getProfileMap(device).get(GL2); - } - - public static boolean isGLES2Available(AbstractGraphicsDevice device) { - return null != getProfileMap(device).get(GLES2); - } - - public static boolean isGLES1Available(AbstractGraphicsDevice device) { - return null != getProfileMap(device).get(GLES1); - } - - public static boolean isGL2ES1Available(AbstractGraphicsDevice device) { - return null != getProfileMap(device).get(GL2ES1); - } - - public static boolean isGL2ES2Available(AbstractGraphicsDevice device) { - return null != getProfileMap(device).get(GL2ES2); - } - - /** Uses the default device */ - public static boolean isGL4bcAvailable() { - return isGL4bcAvailable(null); - } - - /** Uses the default device */ - public static boolean isGL4Available() { - return isGL4Available(null); - } - - /** Uses the default device */ - public static boolean isGL3bcAvailable() { - return isGL3bcAvailable(null); - } - - /** Uses the default device */ - public static boolean isGL3Available() { - return isGL3Available(null); - } - - /** Uses the default device */ - public static boolean isGL2Available() { - return isGL2Available(null); - } - - /** Uses the default device */ - public static boolean isGLES2Available() { - return isGLES2Available(null); - } - - /** Uses the default device */ - public static boolean isGLES1Available() { - return isGLES1Available(null); + /** + * Returns the availability of a profile on a device. + * + * @param device a valid AbstractGraphicsDevice, or <code>null</null> for the default device. + * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..), + * or <code>[ null, GL ]</code> for the default profile. + * @return true if the profile is available for the device, otherwise false. + */ + public static boolean isAvailable(AbstractGraphicsDevice device, String profile) { + HashMap profileMap = null; + try { + return null != getProfileMap(device).get(profile); + } catch (GLException gle) { /* profiles for device n/a */ } + return false; } - /** Uses the default device */ - public static boolean isGL2ES1Available() { - return isGL2ES1Available(null); + /** + * Returns the availability of a profile on the default device. + * + * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..), + * or <code>[ null, GL ]</code> for the default profile. + * @return true if the profile is available for the default device, otherwise false. + */ + public static boolean isAvailable(String profile) { + return isAvailable(null, profile); } - - /** Uses the default device */ - public static boolean isGL2ES2Available() { - return isGL2ES2Available(null); + + /** + * Returns the availability of any profile on the default device. + * + * @return true if any profile is available for the default device, otherwise false. + */ + public static boolean isAnyAvailable() { + return isAvailable(null, null); } - + public static String glAvailabilityToString(AbstractGraphicsDevice device) { boolean avail; StringBuffer sb = new StringBuffer(); @@ -239,67 +191,73 @@ public class GLProfile { } sb.append("GLAvailability[Native[GL4bc "); - avail=isGL4bcAvailable(device); + avail=isAvailable(device, GL4bc); sb.append(avail); if(avail) { glAvailabilityToString(device, sb, 4, GLContext.CTX_PROFILE_COMPAT); } sb.append(", GL4 "); - avail=isGL4Available(device); + avail=isAvailable(device, GL4); sb.append(avail); if(avail) { glAvailabilityToString(device, sb, 4, GLContext.CTX_PROFILE_CORE); } sb.append(", GL3bc "); - avail=isGL3bcAvailable(device); + avail=isAvailable(device, GL3bc); sb.append(avail); if(avail) { glAvailabilityToString(device, sb, 3, GLContext.CTX_PROFILE_COMPAT); } sb.append(", GL3 "); - avail=isGL3Available(device); + avail=isAvailable(device, GL3); sb.append(avail); if(avail) { glAvailabilityToString(device, sb, 3, GLContext.CTX_PROFILE_CORE); } sb.append(", GL2 "); - avail=isGL2Available(device); + avail=isAvailable(device, GL2); sb.append(avail); if(avail) { glAvailabilityToString(device, sb, 2, GLContext.CTX_PROFILE_COMPAT); } sb.append(", GL2ES1 "); - sb.append(isGL2ES1Available(device)); + sb.append(isAvailable(device, GL2ES1)); sb.append(", GLES1 "); - avail=isGLES1Available(device); + avail=isAvailable(device, GLES1); sb.append(avail); if(avail) { glAvailabilityToString(device, sb, 1, GLContext.CTX_PROFILE_ES); } sb.append(", GL2ES2 "); - sb.append(isGL2ES2Available(device)); + sb.append(isAvailable(device, GL2ES2)); sb.append(", GLES2 "); - avail=isGLES2Available(device); + avail=isAvailable(device, GLES2); sb.append(avail); if(avail) { glAvailabilityToString(device, sb, 2, GLContext.CTX_PROFILE_ES); } sb.append("], Profiles["); - for(Iterator i=getProfileMap(device).values().iterator(); i.hasNext(); ) { - sb.append(((GLProfile)i.next()).toString()); - sb.append(", "); + HashMap profileMap = null; + try { + profileMap = getProfileMap(device); + } catch (GLException gle) { /* profiles for device n/a */ } + if(null != profileMap) { + for(Iterator i=profileMap.values().iterator(); i.hasNext(); ) { + sb.append(((GLProfile)i.next()).toString()); + sb.append(", "); + } + sb.append(", default "); + sb.append(getDefault(device)); } - sb.append(", default "); - sb.append(getDefault(device)); sb.append("]]"); return sb.toString(); @@ -456,6 +414,7 @@ public class GLProfile { /** Returns a default GLProfile object, reflecting the best for the running platform. * It selects the first of the set {@link GLProfile#GL_PROFILE_LIST_ALL} + * @throws GLException if no profile is available for the device. * @see #GL_PROFILE_LIST_ALL */ public static GLProfile getDefault(AbstractGraphicsDevice device) { @@ -463,7 +422,9 @@ public class GLProfile { return glp; } - /** Uses the default device */ + /** Uses the default device + * @throws GLException if no profile is available for the default device. + */ public static GLProfile getDefault() { return getDefault(defaultDevice); } @@ -472,7 +433,7 @@ public class GLProfile { * Returns the highest profile. * It selects the first of the set: {@link GLProfile#GL_PROFILE_LIST_MAX} * - * @throws GLException if no implementation for the given profile is found. + * @throws GLException if no profile is available for the device. * @see #GL_PROFILE_LIST_MAX */ public static GLProfile getMaximum(AbstractGraphicsDevice device) @@ -481,7 +442,9 @@ public class GLProfile { return get(device, GL_PROFILE_LIST_MAX); } - /** Uses the default device */ + /** Uses the default device + * @throws GLException if no profile is available for the default device. + */ public static GLProfile getMaximum() throws GLException { @@ -492,7 +455,7 @@ public class GLProfile { * Returns the lowest desktop profile. * It selects the first of the set: {@link GLProfile#GL_PROFILE_LIST_MIN_DESKTOP} * - * @throws GLException if no implementation for the given profile is found. + * @throws GLException if no desktop profile is available for the device. * @see #GL_PROFILE_LIST_MIN_DESKTOP */ public static GLProfile getMinDesktop(AbstractGraphicsDevice device) @@ -501,7 +464,9 @@ public class GLProfile { return get(device, GL_PROFILE_LIST_MIN_DESKTOP); } - /** Uses the default device */ + /** Uses the default device + * @throws GLException if no desktop profile is available for the default device. + */ public static GLProfile getMinDesktop() throws GLException { @@ -513,7 +478,7 @@ public class GLProfile { * Returns the highest profile, implementing the fixed function pipeline. * It selects the first of the set: {@link GLProfile#GL_PROFILE_LIST_MAX_FIXEDFUNC} * - * @throws GLException if no implementation for the given profile is found. + * @throws GLException if no fixed function profile is available for the device. * @see #GL_PROFILE_LIST_MAX_FIXEDFUNC */ public static GLProfile getMaxFixedFunc(AbstractGraphicsDevice device) @@ -522,7 +487,9 @@ public class GLProfile { return get(device, GL_PROFILE_LIST_MAX_FIXEDFUNC); } - /** Uses the default device */ + /** Uses the default device + * @throws GLException if no fixed function profile is available for the default device. + */ public static GLProfile getMaxFixedFunc() throws GLException { @@ -533,7 +500,7 @@ public class GLProfile { * Returns the highest profile, implementing the programmable shader pipeline. * It selects the first of the set: {@link GLProfile#GL_PROFILE_LIST_MAX_PROGSHADER} * - * @throws GLException if no implementation for the given profile is found. + * @throws GLException if no programmable profile is available for the device. * @see #GL_PROFILE_LIST_MAX_PROGSHADER */ public static GLProfile getMaxProgrammable(AbstractGraphicsDevice device) @@ -542,7 +509,9 @@ public class GLProfile { return get(device, GL_PROFILE_LIST_MAX_PROGSHADER); } - /** Uses the default device */ + /** Uses the default device + * @throws GLException if no programmable profile is available for the default device. + */ public static GLProfile getMaxProgrammable() throws GLException { @@ -553,7 +522,7 @@ public class GLProfile { * Returns an available GL2ES1 compatible profile. * It returns the first available of the set: {@link GLProfile#GL_PROFILE_LIST_GL2ES1}. * - * @throws GLException if no implementation for the given profile is found. + * @throws GLException if no GL2ES1 compatible profile is available for the device. * @see #GL_PROFILE_LIST_GL2ES1 */ public static GLProfile getGL2ES1(AbstractGraphicsDevice device) @@ -566,7 +535,7 @@ public class GLProfile { * Returns an available GL2ES1 compatible profile. * It returns the first available of the set: {@link GLProfile#GL_PROFILE_LIST_GL2ES1}. * - * @throws GLException if no implementation for the given profile is found. + * @throws GLException if no GL2ES1 compatible profile is available for the default device. * @see #GL_PROFILE_LIST_GL2ES1 */ public static GLProfile getGL2ES1() @@ -579,7 +548,7 @@ public class GLProfile { * Returns an available GL2ES2 compatible profile. * It returns the first available of the set: {@link GLProfile#GL_PROFILE_LIST_GL2ES2}. * - * @throws GLException if no implementation for the given profile is found. + * @throws GLException if no GL2ES2 compatible profile is available for the device. * @see #GL_PROFILE_LIST_GL2ES2 */ public static GLProfile getGL2ES2(AbstractGraphicsDevice device) @@ -592,7 +561,7 @@ public class GLProfile { * Returns an available GL2ES2 compatible profile * It returns the first available of the set: {@link GLProfile#GL_PROFILE_LIST_GL2ES2}. * - * @throws GLException if no implementation for the given profile is found. + * @throws GLException if no GL2ES2 compatible profile is available for the default device. * @see #GL_PROFILE_LIST_GL2ES2 */ public static GLProfile getGL2ES2() @@ -606,7 +575,10 @@ public class GLProfile { * A generic value of <code>null</code> or <code>GL</code> will result in * the default profile. * - * @throws GLException if no implementation for the given profile is found. + * @param device a valid AbstractGraphicsDevice, or <code>null</null> for the default device. + * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..), + * or <code>[ null, GL ]</code> for the default profile. + * @throws GLException if the requested profile is not available for the device. */ public static GLProfile get(AbstractGraphicsDevice device, String profile) throws GLException @@ -617,7 +589,11 @@ public class GLProfile { return (GLProfile) getProfileMap(device).get(profile); } - /** Uses the default device */ + /** Uses the default device + * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..), + * or <code>[ null, GL ]</code> for the default profile. + * @throws GLException if the requested profile is not available for the default device. + */ public static GLProfile get(String profile) throws GLException { @@ -628,7 +604,9 @@ public class GLProfile { * Returns the first profile from the given list, * where an implementation is available. * - * @throws GLException if no implementation for the given profile is found. + * @param device a valid AbstractGraphicsDevice, or <code>null</null> for the default device. + * @param profiles array of valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..) + * @throws GLException if the non of the requested profiles is available for the device. */ public static GLProfile get(AbstractGraphicsDevice device, String[] profiles) throws GLException @@ -644,7 +622,10 @@ public class GLProfile { throw new GLException("Profiles "+array2String(profiles)+" not available on device "+device); } - /** Uses the default device */ + /** Uses the default device + * @param profiles array of valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..) + * @throws GLException if the non of the requested profiles is available for the default device. + */ public static GLProfile get(String[] profiles) throws GLException { @@ -1152,7 +1133,6 @@ public class GLProfile { /** * Tries the profiles implementation and native libraries. - * Throws an GLException if no profile could be found at all. */ private static void initProfilesForDefaultDevices(boolean firstUIActionOnProcess) { NativeWindowFactory.initSingleton(firstUIActionOnProcess); @@ -1257,10 +1237,11 @@ public class GLProfile { } } - boolean addedAnyProfile = initProfilesForDevice(defaultDesktopDevice) || - initProfilesForDevice(defaultEGLDevice); - + final boolean addedAnyProfile = initProfilesForDevice(defaultDesktopDevice) || + initProfilesForDevice(defaultEGLDevice); + if(DEBUG) { + System.err.println("GLProfile.init addedAnyProfile "+addedAnyProfile); System.err.println("GLProfile.init isAWTAvailable "+isAWTAvailable); System.err.println("GLProfile.init has desktopFactory "+(null!=desktopFactory)); System.err.println("GLProfile.init hasDesktopGL "+hasDesktopGL); @@ -1271,10 +1252,7 @@ public class GLProfile { System.err.println("GLProfile.init defaultDesktopDevice "+defaultDesktopDevice); System.err.println("GLProfile.init defaultEGLDevice "+defaultEGLDevice); System.err.println("GLProfile.init defaultDevice "+defaultDevice); - } - - if(!addedAnyProfile) { - throw new GLException("No profile available: "+array2String(GL_PROFILE_LIST_ALL)+", "+ glAvailabilityToString()); + System.err.println("GLProfile.init: "+array2String(GL_PROFILE_LIST_ALL)+", "+ glAvailabilityToString()); } } @@ -1289,12 +1267,12 @@ public class GLProfile { GLDrawableFactory factory = GLDrawableFactory.getFactoryImpl(device); factory.enterThreadCriticalZone(); try { - return initProfilesForDeviceImpl(device); + return initProfilesForDeviceCritical(device); } finally { factory.leaveThreadCriticalZone(); } } - private static synchronized boolean initProfilesForDeviceImpl(AbstractGraphicsDevice device) { + private static synchronized boolean initProfilesForDeviceCritical(AbstractGraphicsDevice device) { boolean isSet = GLContext.getAvailableGLVersionsSet(device); if(DEBUG) { @@ -1572,17 +1550,20 @@ public class GLProfile { * - initialization<br< * * @param device the key 'device -> GLProfiles-Map' - * @return the GLProfile HashMap + * @return the GLProfile HashMap if exists, otherwise null + * @throws GLException if no profile for the given device is available. */ - private static HashMap getProfileMap(AbstractGraphicsDevice device) { + private static HashMap getProfileMap(AbstractGraphicsDevice device) throws GLException { validateInitialization(); if(null==device) { device = defaultDevice; } String deviceKey = device.getUniqueID(); HashMap map = (HashMap) deviceConn2ProfileMap.get(deviceKey); - if(null==map) { - initProfilesForDevice(device); + if( null == map ) { + if( !initProfilesForDevice(device) ) { + throw new GLException("No Profile available for "+device); + } if( null == deviceConn2ProfileMap.get(deviceKey) ) { throw new InternalError("initProfilesForDevice(..) didn't issue setProfileMap(..) on "+device); } diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index 160cdce51..80e042dd3 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -165,17 +165,20 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing /** Creates a new GLCanvas component with a default set of OpenGL capabilities, using the default OpenGL capabilities selection - mechanism, on the default screen device. */ - public GLCanvas() { + mechanism, on the default screen device. + * @throws GLException if no default profile is available for the default desktop device. + */ + public GLCanvas() throws GLException { this(null); } /** Creates a new GLCanvas component with the requested set of OpenGL capabilities, using the default OpenGL capabilities selection mechanism, on the default screen device. + * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. * @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, javax.media.opengl.GLContext, java.awt.GraphicsDevice) */ - public GLCanvas(GLCapabilitiesImmutable capsReqUser) { + public GLCanvas(GLCapabilitiesImmutable capsReqUser) throws GLException { this(capsReqUser, null, null, null); } @@ -184,9 +187,12 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing selection mechanism, on the default screen device. * This constructor variant also supports using a shared GLContext. * + * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. * @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, javax.media.opengl.GLContext, java.awt.GraphicsDevice) */ - public GLCanvas(GLCapabilitiesImmutable capsReqUser, GLContext shareWith) { + public GLCanvas(GLCapabilitiesImmutable capsReqUser, GLContext shareWith) + throws GLException + { this(capsReqUser, null, shareWith, null); } @@ -204,11 +210,15 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing sharing</a>. The passed GraphicsDevice indicates the screen on which to create the GLCanvas; the GLDrawableFactory uses the default screen device of the local GraphicsEnvironment if null - is passed for this argument. */ + is passed for this argument. + * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. + */ public GLCanvas(GLCapabilitiesImmutable capsReqUser, GLCapabilitiesChooser chooser, GLContext shareWith, - GraphicsDevice device) { + GraphicsDevice device) + throws GLException + { /* * Determination of the native window is made in 'super.addNotify()', * which creates the native peer using AWT's GraphicsConfiguration. diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 2d58584f7..76d982813 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -199,15 +199,19 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing /** Creates a new GLJPanel component with a default set of OpenGL capabilities and using the default OpenGL capabilities selection - mechanism. */ - public GLJPanel() { + mechanism. + * @throws GLException if no default profile is available for the default desktop device. + */ + public GLJPanel() throws GLException { this(null); } /** Creates a new GLJPanel component with the requested set of OpenGL capabilities, using the default OpenGL capabilities - selection mechanism. */ - public GLJPanel(GLCapabilitiesImmutable userCapsRequest) { + selection mechanism. + * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. + */ + public GLJPanel(GLCapabilitiesImmutable userCapsRequest) throws GLException { this(userCapsRequest, null, null); } @@ -224,8 +228,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing <P> Note: Sharing cannot be enabled using J2D OpenGL FBO sharing, since J2D GL Context must be shared and we can only share one context. + * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. */ - public GLJPanel(GLCapabilitiesImmutable userCapsRequest, GLCapabilitiesChooser chooser, GLContext shareWith) { + public GLJPanel(GLCapabilitiesImmutable userCapsRequest, GLCapabilitiesChooser chooser, GLContext shareWith) + throws GLException + { super(); // Works around problems on many vendors' cards; we don't need a @@ -235,7 +242,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if (userCapsRequest != null) { caps = (GLCapabilities) userCapsRequest.cloneMutable(); } else { - caps = new GLCapabilities(null); + caps = new GLCapabilities(GLProfile.getDefault(GLProfile.getDefaultDesktopDevice())); } caps.setDoubleBuffered(false); offscreenCaps = caps; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java index 898337602..6f044e3d3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java @@ -68,22 +68,22 @@ public class TestGLProfile01NEWT extends UITestCase { GLProfile glp = GLProfile.getDefault(); System.out.println("GLProfile.getDefault(): "+glp); if(glp.getName().equals(GLProfile.GL4bc)) { - Assert.assertTrue(GLProfile.isGL4bcAvailable()); - Assert.assertTrue(GLProfile.isGL3bcAvailable()); - Assert.assertTrue(GLProfile.isGL2Available()); - Assert.assertTrue(GLProfile.isGL2ES1Available()); - Assert.assertTrue(GLProfile.isGL2ES2Available()); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4bc)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3bc)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); } else if(glp.getName().equals(GLProfile.GL3bc)) { - Assert.assertTrue(GLProfile.isGL3bcAvailable()); - Assert.assertTrue(GLProfile.isGL2Available()); - Assert.assertTrue(GLProfile.isGL2ES1Available()); - Assert.assertTrue(GLProfile.isGL2ES2Available()); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3bc)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); } else if(glp.getName().equals(GLProfile.GL2)) { - Assert.assertTrue(GLProfile.isGL2Available()); - Assert.assertTrue(GLProfile.isGL2ES1Available()); - Assert.assertTrue(GLProfile.isGL2ES2Available()); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); } else if(glp.getName().equals(GLProfile.GL2ES1)) { - Assert.assertTrue(GLProfile.isGL2ES1Available()); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1)); } dumpVersion(glp); } @@ -100,29 +100,21 @@ public class TestGLProfile01NEWT extends UITestCase { GLProfile glp = GLProfile.getMaxProgrammable(); System.out.println("GLProfile.getMaxProgrammable(): "+glp); if(glp.getName().equals(GLProfile.GL4)) { - Assert.assertTrue(GLProfile.isGL4Available()); - Assert.assertTrue(GLProfile.isGL3Available()); - Assert.assertTrue(GLProfile.isGL2Available()); - Assert.assertTrue(GLProfile.isGL2ES1Available()); - Assert.assertTrue(GLProfile.isGL2ES2Available()); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); } else if(glp.getName().equals(GLProfile.GL3)) { - Assert.assertTrue(GLProfile.isGL3Available()); - Assert.assertTrue(GLProfile.isGL2Available()); - Assert.assertTrue(GLProfile.isGL2ES1Available()); - Assert.assertTrue(GLProfile.isGL2ES2Available()); - } else if(glp.getName().equals(GLProfile.GL2)) { - Assert.assertTrue(GLProfile.isGL2Available()); - Assert.assertTrue(GLProfile.isGL2ES1Available()); - Assert.assertTrue(GLProfile.isGL2ES2Available()); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); } else if(glp.getName().equals(GLProfile.GL2ES2)) { - Assert.assertTrue(GLProfile.isGL2ES2Available()); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); } dumpVersion(glp); } @Test public void test04GLProfileGL2ES1() throws InterruptedException { - if(!GLProfile.isGL2ES1Available()) { + if(!GLProfile.isAvailable(GLProfile.GL2ES1)) { System.out.println("GLProfile GL2ES1 n/a"); return; } @@ -133,7 +125,7 @@ public class TestGLProfile01NEWT extends UITestCase { @Test public void test05GLProfileGL2ES2() throws InterruptedException { - if(!GLProfile.isGL2ES2Available()) { + if(!GLProfile.isAvailable(GLProfile.GL2ES2)) { System.out.println("GLProfile GL2ES2 n/a"); return; } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java index be4873ff6..a6d04cf24 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java @@ -83,7 +83,7 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase { private GLWindow prepareTest() { - if(!GLProfile.isGL3Available()) { + if(!GLProfile.isAvailable(GLProfile.GL3)) { System.err.println("GL3 not available"); System.err.println(GLProfile.glAvailabilityToString()); return null; @@ -136,7 +136,7 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase { @Test(timeout=60000) public void testGlTransformFeedbackVaryings_WhenVarNameOK() { - if(!GLProfile.isGL3Available()) { + if(!GLProfile.isAvailable(GLProfile.GL3)) { return; } ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -178,7 +178,7 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase { @Test(timeout=60000) public void testGlTransformFeedbackVaryings_WhenVarNameWrong() { - if(!GLProfile.isGL3Available()) { + if(!GLProfile.isAvailable(GLProfile.GL3)) { return; } ByteArrayOutputStream baos = new ByteArrayOutputStream(); |