/** * 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(final AbstractGraphicsDevice device) throws GLException { getProfileMap(device, true); }
/** Returns a GLProfile object. * verifies the given profile and chooses an appropriate implementation. * A generic value of <code>null</code> or <code>GL</code> will result in * the default profile. * * @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(final AbstractGraphicsDevice device, String profile) throws GLException { if(null==profile || profile == GL_GL) { profile = GL_DEFAULT; } final HashMap<String /*GLProfile_name*/, GLProfile> glpMap = getProfileMap(device, true); final GLProfile glp = glpMap.get(profile); if(null == glp) { throw new GLException("Profile "+profile+" is not available on "+device+", but: "+glpMap.values()); } return glp; }
/** * 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(final AbstractGraphicsDevice device, final String profile) { initSingleton(); return isAvailableImpl(getProfileMap(device, false), profile); } private static boolean isAvailableImpl(final HashMap<String /*GLProfile_name*/, GLProfile> map, final String profile) {
final HashMap<String /*GLProfile_name*/, GLProfile> map = getProfileMap(device, true); for(int i=0; i<profiles.length; i++) { final GLProfile glProfile = map.get(profiles[i]);
device = defaultDevice; final HashMap<String /*GLProfile_name*/, GLProfile> map = getProfileMap(device, false);