/** * Returns a unique String object using {@link String#intern()} for the given arguments, * which object reference itself can be used as a key. */ protected static String getDeviceVersionAvailableKey(final AbstractGraphicsDevice device, final int major, final int profile) { final String r = device.getUniqueID() + "-" + toHexString(composeBits(major, profile, 0)); return r.intern(); }
/** * Called by {@link jogamp.opengl.GLContextImpl#createContextARBMapVersionsAvailable(int,int)} not intended to be used by * implementations. However, if {@link jogamp.opengl.GLContextImpl#createContextARB(long, boolean)} is not being used within * {@link javax.media.opengl.GLDrawableFactory#getOrCreateSharedContext(javax.media.nativewindow.AbstractGraphicsDevice)}, * GLProfile has to map the available versions. * * @param reqMajor Key Value either 1, 2, 3 or 4 * @param profile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES} * @return the old mapped value * * @see #createContextARBMapVersionsAvailable */ protected static Integer mapAvailableGLVersion(final AbstractGraphicsDevice device, final int reqMajor, final int profile, final int resMajor, final int resMinor, int resCtp) { validateProfileBits(profile, "profile"); validateProfileBits(resCtp, "resCtp"); if(FORCE_NO_FBO_SUPPORT) { resCtp &= ~CTX_IMPL_FBO ; } if(DEBUG) { System.err.println("GLContext.mapAvailableGLVersion: "+device+": "+getGLVersion(reqMajor, 0, profile, null)+" -> "+getGLVersion(resMajor, resMinor, resCtp, null)); // Thread.dumpStack(); } final String objectKey = getDeviceVersionAvailableKey(device, reqMajor, profile); final Integer val = Integer.valueOf(composeBits(resMajor, resMinor, resCtp)); synchronized(deviceVersionAvailable) { return deviceVersionAvailable.put( objectKey, val ); } }