38package com.jogamp.opengl;
40import jogamp.opengl.Debug;
41import jogamp.opengl.GLDrawableFactoryImpl;
42import jogamp.opengl.GLDynamicLookupHelper;
44import com.jogamp.common.ExceptionUtils;
45import com.jogamp.common.GlueGenVersion;
46import com.jogamp.common.jvm.JNILibLoaderBase;
47import com.jogamp.common.os.Platform;
48import com.jogamp.common.util.PropertyAccess;
49import com.jogamp.common.util.ReflectionUtil;
50import com.jogamp.common.util.SecurityUtil;
51import com.jogamp.common.util.VersionUtil;
52import com.jogamp.common.util.cache.TempJarCache;
53import com.jogamp.common.util.locks.LockFactory;
54import com.jogamp.common.util.locks.RecursiveThreadGroupLock;
55import com.jogamp.gluegen.runtime.FunctionAddressResolver;
56import com.jogamp.nativewindow.NativeWindowVersion;
58import com.jogamp.nativewindow.AbstractGraphicsDevice;
59import com.jogamp.nativewindow.NativeWindowFactory;
60import com.jogamp.opengl.fixedfunc.GLPointerFunc;
62import java.lang.reflect.Constructor;
63import java.security.PrivilegedAction;
64import java.util.HashMap;
79 public static final boolean DEBUG;
151 Platform.initSingleton();
152 final boolean isIOS = Platform.OSType.IOS == Platform.getOSType();
153 final boolean isOSXorIOS = Platform.OSType.MACOS == Platform.getOSType() || isIOS;
155 DEBUG = Debug.debug(
"GLProfile");
157 disableOpenGLCore = PropertyAccess.isPropertyDefined(
"jogl.disable.openglcore",
true) && !isOSXorIOS;
158 disableOpenGLARBContext = PropertyAccess.isPropertyDefined(
"jogl.disable.openglarbcontext",
true) && !isOSXorIOS;
162 enableANGLE = PropertyAccess.isPropertyDefined(
"jogl.enable.ANGLE",
true);
205 final boolean justInitialized;
210 justInitialized =
true;
212 System.err.println(
"GLProfile.initSingleton() - thread "+Thread.currentThread().getName());
213 ExceptionUtils.dumpStack(System.err);
216 if(ReflectionUtil.DEBUG_STATS_FORNAME) {
217 ReflectionUtil.resetForNameCount();
222 SecurityUtil.doPrivileged(
new PrivilegedAction<Object>() {
224 public Object run() {
225 Platform.initSingleton();
227 if( TempJarCache.isInitialized(
true) ) {
228 final ClassLoader cl =
GLProfile.class.getClassLoader();
229 final String newtDebugClassName =
"jogamp.newt.Debug";
230 final Class<?>[] classesFromJavaJars =
new Class<?>[] { jogamp.nativewindow.Debug.class, jogamp.opengl.Debug.class,
null };
231 if( ReflectionUtil.isClassAvailable(newtDebugClassName, cl) ) {
232 classesFromJavaJars[2] = ReflectionUtil.getClass(newtDebugClassName,
false, cl);
234 JNILibLoaderBase.addNativeJarLibsJoglCfg(classesFromJavaJars);
236 initProfilesForDefaultDevices();
240 if( ReflectionUtil.DEBUG_STATS_FORNAME ) {
241 if( justInitialized ) {
242 System.err.println(ReflectionUtil.getForNameStats(
null).toString());
246 justInitialized =
false;
252 if( justInitialized && ( hasGL234Impl || hasGL234OnMobileImpl || hasGLES1Impl || hasGLES3Impl ) ) {
265 getProfileMap(device,
true);
283 System.err.println(
"GLProfile.shutdown() - thread "+Thread.currentThread().getName());
284 ExceptionUtils.dumpStack(System.err);
307 return isAvailableImpl(getProfileMap(device,
false), profile);
309 private static boolean isAvailableImpl(
final HashMap<String /*GLProfile_name*/, GLProfile> map,
final String profile) {
310 return null != map &&
null != map.get(profile);
340 private static StringBuilder doIndent(
final StringBuilder sb,
final String indent,
int indentCount) {
341 while(indentCount>0) {
350 sb =
new StringBuilder();
352 final boolean useIndent =
null != indent;
360 device = defaultDevice;
362 final HashMap<String ,
GLProfile> map = getProfileMap(device,
false);
365 doIndent(sb, indent, indentCount).append(
"Natives");
367 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
GL4bc+
" ").append(indent);
369 sb.append(
"Natives["+
GL4bc+
" ");
371 avail=isAvailableImpl(map,
GL4bc);
380 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
GL4+
" ").append(indent);
382 sb.append(
", "+
GL4+
" ");
384 avail=isAvailableImpl(map,
GL4);
393 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
GLES3+
" ").append(indent);
395 sb.append(
", "+
GLES3+
" ");
397 avail=isAvailableImpl(map,
GLES3);
406 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
GL3bc+
" ").append(indent);
408 sb.append(
", "+
GL3bc+
" ");
410 avail=isAvailableImpl(map,
GL3bc);
419 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
GL3+
" ").append(indent);
421 sb.append(
", "+
GL3+
" ");
423 avail=isAvailableImpl(map,
GL3);
432 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
GL2+
" ").append(indent);
434 sb.append(
", "+
GL2+
" ");
436 avail=isAvailableImpl(map,
GL2);
445 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
GLES2+
" ").append(indent);
447 sb.append(
", "+
GLES2+
" ");
449 avail=isAvailableImpl(map,
GLES2);
458 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
GLES1+
" ").append(indent);
460 sb.append(
", "+
GLES1+
" ");
462 avail=isAvailableImpl(map,
GLES1);
471 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
"Count\t"+nativeCount+
" / "+allCount);
473 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
"Common");
476 sb.append(
", count "+nativeCount+
" / "+allCount+
"], Common[");
480 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
GL4ES3+
" ").append(indent);
482 sb.append(
", "+
GL4ES3+
" ");
484 sb.append(isAvailableImpl(map,
GL4ES3));
488 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
GL2GL3+
" ").append(indent);
490 sb.append(
", "+
GL2GL3+
" ");
492 sb.append(isAvailableImpl(map,
GL2GL3));
496 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
GL2ES2+
" ").append(indent);
498 sb.append(
", "+
GL2ES2+
" ");
500 sb.append(isAvailableImpl(map,
GL2ES2));
504 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
GL2ES1+
" ").append(indent);
506 sb.append(
", "+
GL2ES1+
" ");
508 sb.append(isAvailableImpl(map,
GL2ES1));
513 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
"Mappings");
516 sb.append(
"], Mappings[");
519 int profileCount = 0;
522 for (
final Map.Entry<String,
GLProfile> entry : map.entrySet()) {
523 if( GL_DEFAULT != entry.getKey() ) {
525 doIndent(sb.append(Platform.getNewline()), indent, indentCount);
527 sb.append(entry.getKey()+(useIndent?
" \t":
" ")+entry.getValue());
535 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
"default ");
537 sb.append(
", default ");
546 doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(
"Count\t"+profileCount+
" / "+allCount);
547 sb.append(Platform.getNewline());
549 sb.append(
", count "+profileCount+
" / "+allCount+
"]");
566 public static final String
GL4bc =
"GL4bc";
569 public static final String
GL4 =
"GL4";
573 public static final String
GL3bc =
"GL3bc";
576 public static final String
GL3 =
"GL3";
579 public static final String
GL2 =
"GL2";
582 public static final String
GLES1 =
"GLES1";
585 public static final String
GLES2 =
"GLES2";
588 public static final String
GLES3 =
"GLES3";
591 public static final String
GL2ES1 =
"GL2ES1";
594 public static final String
GL2ES2 =
"GL2ES2";
597 public static final String
GL2GL3 =
"GL2GL3";
600 public static final String
GL4ES3 =
"GL4ES3";
603 private static final String GL_DEFAULT =
"GL_DEFAULT";
605 private static final String GL_GL =
"GL";
629 public static final String[]
GL_PROFILE_LIST_ALL =
new String[] {
GL4bc,
GL3bc,
GL2,
GL4,
GL3,
GLES3,
GL4ES3,
GL2GL3,
GLES2,
GL2ES2,
GLES1,
GL2ES1 };
740 final GLProfile glp =
get(device, GL_DEFAULT);
1003 if(
null==profile || profile == GL_GL) {
1004 profile = GL_DEFAULT;
1006 final HashMap<String ,
GLProfile> glpMap = getProfileMap(device,
true);
1009 throw new GLException(
"Profile "+profile+
" is not available on "+device+
", but: "+glpMap.values());
1022 return get(defaultDevice, profile);
1039 final HashMap<String ,
GLProfile> map = getProfileMap(device,
true);
1040 for(
int i=0; i<profiles.length; i++) {
1042 if(
null!=glProfile) {
1043 if(!favorHardwareRasterizer) {
1046 if(glProfile.isHardwareRasterizer()) {
1049 if(
null==glProfileAny) {
1050 glProfileAny = glProfile;
1054 if(
null!=glProfileAny) {
1055 return glProfileAny;
1057 throw new GLException(
"Profiles "+array2String(profiles)+
" not available on device "+device);
1065 public static GLProfile get(
final String[] profiles,
final boolean favorHardwareRasterizer)
1068 return get(defaultDevice, profiles, favorHardwareRasterizer);
1075 return GLES1 == profileImpl;
1082 return GLES3 == profileImpl ||
GLES2 == profileImpl;
1089 return GLES3 == profileImpl;
1104 return "GL_UNSIGNED_BYTE";
1108 return "GL_UNSIGNED_SHORT";
1115 case com.jogamp.opengl.GL2ES2.GL_INT:
1118 return "GL_UNSIGNED_INT";
1119 case com.jogamp.opengl.GL2GL3.GL_DOUBLE:
1121 case com.jogamp.opengl.GL2.GL_2_BYTES:
1122 return "GL_2_BYTES";
1123 case com.jogamp.opengl.GL2.GL_3_BYTES:
1124 return "GL_3_BYTES";
1125 case com.jogamp.opengl.GL2.GL_4_BYTES:
1126 return "GL_4_BYTES";
1134 return "GL_VERTEX_ARRAY";
1136 return "GL_NORMAL_ARRAY";
1138 return "GL_COLOR_ARRAY";
1140 return "GL_TEXTURE_COORD_ARRAY";
1149 if(
GLES2 == profileImpl ||
GLES3 == profileImpl ) {
1150 return "jogamp.opengl.es3.GLES3";
1151 }
else if(
GLES1 == profileImpl ) {
1152 return "jogamp.opengl.es1.GLES1";
1153 }
else if (
GL4bc == profileImpl ||
1154 GL4 == profileImpl ||
1155 GL3bc == profileImpl ||
1156 GL3 == profileImpl ||
1157 GL2 == profileImpl ) {
1158 return "jogamp.opengl.gl4.GL4bc";
1160 throw new GLException(
"unsupported profile \"" + profileImpl +
"\"");
1164 public final Constructor<?>
getGLCtor(
final boolean glObject) {
1167 private static final Constructor<?>
getGLCtor(
final String profileImpl,
final boolean glObject) {
1168 if(
GLES2 == profileImpl ||
GLES3 == profileImpl ) {
1169 return glObject ? ctorGLES3Impl : ctorGLES3ProcAddr;
1170 }
else if(
GLES1 == profileImpl ) {
1171 return glObject ? ctorGLES1Impl : ctorGLES1ProcAddr;
1172 }
else if (
GL4bc == profileImpl ||
1173 GL4 == profileImpl ||
1174 GL3bc == profileImpl ||
1175 GL3 == profileImpl ||
1176 GL2 == profileImpl ) {
1177 return glObject ? ctorGL234Impl : ctorGL234ProcAddr;
1179 throw new GLException(
"unsupported profile \"" + profileImpl +
"\"");
1189 public final boolean equals(
final Object o) {
1190 if(
this==o) {
return true; }
1202 hash = 97 * hash +
getName().hashCode();
1212 throw new GLException(
"GLProfiles are not equal: "+
this+
" != "+glp);
1223 return null != profileImpl ? profileImpl :
this;
1228 return isHardwareRasterizer;
1235 return null != profileImpl ? profileImpl.getName() :
getName();
1240 return GL4bc == profile;
1265 return GLES1 == profile;
1275 return GLES3 == profile;
1357 case com.jogamp.opengl.GL2ES2.GL_INT:
1362 case com.jogamp.opengl.GL2GL3.GL_DOUBLE:
1366 case com.jogamp.opengl.GL2.GL_2_BYTES:
1367 case com.jogamp.opengl.GL2.GL_3_BYTES:
1368 case com.jogamp.opengl.GL2.GL_4_BYTES:
1373 if(throwException) {
1374 throw new GLException(
"Illegal data type on profile "+
this+
": "+type);
1386 final boolean isVertexAttribPointer,
final boolean throwException) {
1388 if(isVertexAttribPointer) {
1389 if(throwException) {
1404 if(throwException) {
1416 if(throwException) {
1430 if(throwException) {
1440 if(throwException) {
1453 if(throwException) {
1463 if(throwException) {
1477 case com.jogamp.opengl.GL2ES2.GL_INT:
1483 case com.jogamp.opengl.GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV:
1487 if(throwException) {
1488 throw new GLException(
"Illegal data type on profile GLES3: "+type);
1517 if(throwException) {
1518 throw new GLException(
"Illegal data type on profile GLES2: "+type);
1537 if(isVertexAttribPointer) {
1543 case com.jogamp.opengl.GL2ES2.GL_INT:
1549 case com.jogamp.opengl.GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV:
1550 case com.jogamp.opengl.GL2GL3.GL_DOUBLE:
1554 if(throwException) {
1555 throw new GLException(
"Illegal data type on profile GL2: "+type);
1567 if(throwException) {
1568 throw new GLException(
"Illegal component number on profile GL2: "+comps);
1578 case com.jogamp.opengl.GL2ES2.GL_INT:
1579 case com.jogamp.opengl.GL2GL3.GL_DOUBLE:
1582 if(throwException) {
1594 if(throwException) {
1605 case com.jogamp.opengl.GL2ES2.GL_INT:
1606 case com.jogamp.opengl.GL2GL3.GL_DOUBLE:
1609 if(throwException) {
1619 if(throwException) {
1632 case com.jogamp.opengl.GL2ES2.GL_INT:
1634 case com.jogamp.opengl.GL2GL3.GL_DOUBLE:
1637 if(throwException) {
1648 if(throwException) {
1658 case com.jogamp.opengl.GL2ES2.GL_INT:
1659 case com.jogamp.opengl.GL2GL3.GL_DOUBLE:
1662 if(throwException) {
1675 if(throwException) {
1689 return "GLProfile[" +
getName() +
"/" +
getImplName() +
"."+(this.isHardwareRasterizer?
"hw":
"sw")+(isCustom?
".custom":
"")+
"]";
1692 private static boolean isAWTAvailable;
1694 private static boolean hasDesktopGLFactory;
1695 private static boolean hasGL234Impl;
1696 private static boolean hasMobileFactory;
1697 private static boolean hasGLES3Impl;
1698 private static boolean hasGLES1Impl;
1699 private static boolean hasGL234OnMobileImpl;
1700 private static Constructor<?> ctorGL234Impl;
1701 private static Constructor<?> ctorGLES3Impl;
1702 private static Constructor<?> ctorGLES1Impl;
1703 private static Constructor<?> ctorGL234ProcAddr;
1704 private static Constructor<?> ctorGLES3ProcAddr;
1705 private static Constructor<?> ctorGLES1ProcAddr;
1707 private static GLDrawableFactoryImpl mobileFactory =
null;
1708 private static GLDrawableFactoryImpl desktopFactory =
null;
1711 private static boolean initialized =
false;
1712 private static final RecursiveThreadGroupLock initLock = LockFactory.createRecursiveThreadGroupLock();
1714 private static final Class<?>[] ctorGLArgs =
new Class<?>[] {
GLProfile.class, jogamp.opengl.GLContextImpl.class };
1715 private static final Class<?>[] ctorProcArgs =
new Class<?>[] { FunctionAddressResolver.class };
1716 private static final String GL4bcImplClassName =
"jogamp.opengl.gl4.GL4bcImpl";
1717 private static final String GL4bcProcClassName =
"jogamp.opengl.gl4.GL4bcProcAddressTable";
1718 private static final String GLES1ImplClassName =
"jogamp.opengl.es1.GLES1Impl";
1719 private static final String GLES1ProcClassName =
"jogamp.opengl.es1.GLES1ProcAddressTable";
1720 private static final String GLES3ImplClassName =
"jogamp.opengl.es3.GLES3Impl";
1721 private static final String GLES3ProcClassName =
"jogamp.opengl.es3.GLES3ProcAddressTable";
1723 private static final Constructor<?> getCtor(
final String clazzName,
final boolean glObject,
final ClassLoader cl) {
1725 return ReflectionUtil.getConstructor(clazzName, glObject ? ctorGLArgs : ctorProcArgs,
false, cl);
1726 }
catch (
final Throwable t) {
1728 System.err.println(
"Caught: "+t.getMessage());
1729 t.printStackTrace();
1735 private static final void initGLCtorImpl() {
1736 final ClassLoader classloader = GLProfile.class.getClassLoader();
1740 final Constructor<?> ctorGL = getCtor(GL4bcImplClassName,
true, classloader);
1741 final Constructor<?> ctorProc =
null != ctorGL ? getCtor(GL4bcProcClassName,
false, classloader) : null;
1742 if(
null != ctorProc ) {
1743 hasGL234Impl =
true;
1744 ctorGL234Impl = ctorGL;
1745 ctorGL234ProcAddr = ctorProc;
1747 hasGL234Impl =
false;
1748 ctorGL234Impl =
null;
1749 ctorGL234ProcAddr =
null;
1752 hasGL234OnMobileImpl = hasGL234Impl;
1756 final Constructor<?> ctorGL = getCtor(GLES1ImplClassName,
true, classloader);
1757 final Constructor<?> ctorProc =
null != ctorGL ? getCtor(GLES1ProcClassName,
false, classloader) : null;
1758 if(
null != ctorProc ) {
1759 hasGLES1Impl =
true;
1760 ctorGLES1Impl = ctorGL;
1761 ctorGLES1ProcAddr = ctorProc;
1763 hasGLES1Impl =
false;
1764 ctorGLES1Impl =
null;
1765 ctorGLES1ProcAddr =
null;
1769 final Constructor<?> ctorGL = getCtor(GLES3ImplClassName,
true, classloader);
1770 final Constructor<?> ctorProc =
null != ctorGL ? getCtor(GLES3ProcClassName,
false, classloader) : null;
1771 if(
null != ctorProc ) {
1772 hasGLES3Impl =
true;
1773 ctorGLES3Impl = ctorGL;
1774 ctorGLES3ProcAddr = ctorProc;
1776 hasGLES3Impl =
false;
1777 ctorGLES3Impl =
null;
1778 ctorGLES3ProcAddr =
null;
1786 private static void initProfilesForDefaultDevices() {
1787 NativeWindowFactory.initSingleton();
1789 System.err.println(
"GLProfile.init - thread: " + Thread.currentThread().getName());
1790 System.err.println(VersionUtil.getPlatformInfo());
1791 System.err.println(GlueGenVersion.getInstance());
1792 System.err.println(NativeWindowVersion.getInstance());
1793 System.err.println(JoglVersion.getInstance());
1796 final ClassLoader classloader = GLProfile.class.getClassLoader();
1798 isAWTAvailable = NativeWindowFactory.isAWTAvailable() &&
1799 ReflectionUtil.isClassAvailable(
"com.jogamp.opengl.awt.GLCanvas", classloader) ;
1810 GLDrawableFactory.initSingleton();
1815 desktopFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getFactoryImpl(
GL2);
1816 if(
null != desktopFactory) {
1817 final GLDynamicLookupHelper glLookupHelper = desktopFactory.getGLDynamicLookupHelper(2, GLContext.CTX_PROFILE_COMPAT);
1818 hasGL234Impl =
null!=glLookupHelper && glLookupHelper.isLibComplete() && hasGL234Impl;
1819 hasDesktopGLFactory = hasGL234Impl;
1821 }
catch (
final LinkageError le) {
1823 }
catch (
final RuntimeException re) {
1825 }
catch (
final Throwable tt) {
1830 t.printStackTrace();
1834 final AbstractGraphicsDevice defaultDesktopDevice;
1835 if(
null == desktopFactory) {
1836 hasDesktopGLFactory =
false;
1837 hasGL234Impl =
false;
1838 defaultDesktopDevice =
null;
1840 System.err.println(
"Info: GLProfile.init - Desktop GLDrawable factory not available");
1843 defaultDesktopDevice = desktopFactory.getDefaultDevice();
1848 mobileFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getFactoryImpl(
GLES2);
1849 if(
null != mobileFactory) {
1851 final GLDynamicLookupHelper es2DynLookup = mobileFactory.getGLDynamicLookupHelper(2, GLContext.CTX_PROFILE_ES);
1852 final GLDynamicLookupHelper es1DynLookup = mobileFactory.getGLDynamicLookupHelper(1, GLContext.CTX_PROFILE_ES);
1853 final GLDynamicLookupHelper glXDynLookup = mobileFactory.getGLDynamicLookupHelper(3, GLContext.CTX_PROFILE_CORE);
1854 hasGLES3Impl =
null!=es2DynLookup && es2DynLookup.isLibComplete() && hasGLES3Impl;
1855 hasGLES1Impl =
null!=es1DynLookup && es1DynLookup.isLibComplete() && hasGLES1Impl;
1856 hasGL234OnMobileImpl =
null!=glXDynLookup && glXDynLookup.isLibComplete() && hasGL234OnMobileImpl;
1857 hasMobileFactory = hasGLES3Impl || hasGLES1Impl || hasGL234OnMobileImpl;
1859 }
catch (
final LinkageError le) {
1861 }
catch (
final SecurityException se) {
1863 }
catch (
final NullPointerException npe) {
1865 }
catch (
final RuntimeException re) {
1870 t.printStackTrace();
1874 final AbstractGraphicsDevice defaultMobileDevice;
1875 if(
null == mobileFactory) {
1876 hasMobileFactory =
false;
1877 hasGL234OnMobileImpl=
false;
1878 hasGLES3Impl =
false;
1879 hasGLES1Impl =
false;
1880 defaultMobileDevice =
null;
1882 System.err.println(
"Info: GLProfile.init - Mobile GLDrawable factory not available");
1885 defaultMobileDevice = mobileFactory.getDefaultDevice();
1888 if(
null != defaultDesktopDevice ) {
1889 defaultDevice = defaultDesktopDevice;
1891 System.err.println(
"Info: GLProfile.init - Default device is desktop derived: "+defaultDevice);
1893 }
else if (
null != defaultMobileDevice ) {
1894 defaultDevice = defaultMobileDevice;
1896 System.err.println(
"Info: GLProfile.init - Default device is mobile derived: "+defaultDevice);
1900 System.err.println(
"Info: GLProfile.init - Default device not available");
1902 defaultDevice =
null;
1906 final boolean addedMobileProfile =
null != defaultMobileDevice ? initProfilesForDevice(defaultMobileDevice) : false;
1907 final boolean addedDesktopProfile =
null != defaultDesktopDevice ? initProfilesForDevice(defaultDesktopDevice) : false;
1908 final boolean addedAnyProfile = addedMobileProfile || addedDesktopProfile ;
1911 System.err.println(
"GLProfile.init addedAnyProfile "+addedAnyProfile+
" (desktop: "+addedDesktopProfile+
", mobile "+addedMobileProfile+
")");
1912 System.err.println(
"GLProfile.init isAWTAvailable "+isAWTAvailable);
1913 System.err.println(
"GLProfile.init hasDesktopGLFactory "+hasDesktopGLFactory);
1914 System.err.println(
"GLProfile.init hasGL234Impl "+hasGL234Impl);
1915 System.err.println(
"GLProfile.init hasMobileFactory "+hasMobileFactory);
1916 System.err.println(
"GLProfile.init hasGLES1Impl "+hasGLES1Impl);
1917 System.err.println(
"GLProfile.init hasGLES3Impl "+hasGLES3Impl);
1918 System.err.println(
"GLProfile.init hasGL234OnEGLImpl "+hasGL234OnMobileImpl);
1919 System.err.println(
"GLProfile.init defaultDevice "+defaultDevice);
1920 System.err.println(
"GLProfile.init defaultDevice Desktop "+defaultDesktopDevice);
1921 System.err.println(
"GLProfile.init defaultDevice Mobile "+defaultMobileDevice);
1930 private static boolean initProfilesForDevice(
final AbstractGraphicsDevice device) {
1931 if(
null == device) {
1936 final GLDrawableFactory factory = GLDrawableFactory.getFactory(device);
1937 if(
null != factory ) {
1938 factory.enterThreadCriticalZone();
1940 return initProfilesForDeviceCritical(device);
1942 factory.leaveThreadCriticalZone();
1950 private static boolean initProfilesForDeviceCritical(
final AbstractGraphicsDevice device) {
1951 final boolean isSet = GLContext.getAvailableGLVersionsSet(device);
1954 System.err.println(
"Info: GLProfile.initProfilesForDevice: "+device+
" ("+device.getClass().getName()+
"), isSet "+isSet+
", hasDesktopGLFactory "+hasDesktopGLFactory+
", hasEGLFactory "+hasMobileFactory);
1958 final String deviceKey = device.getUniqueID();
1959 final HashMap<String , GLProfile> map = deviceConn2ProfileMap.get(deviceKey);
1961 throw new InternalError(
"GLContext Avail. GLVersion is set - but no profile map for device: "+device);
1963 return null != map.get(GL_DEFAULT);
1966 HashMap<String, GLProfile> mappedDesktopProfiles =
null;
1967 boolean addedDesktopProfile =
false;
1968 HashMap<String, GLProfile> mappedEGLProfiles =
null;
1969 boolean addedMobileProfile =
false;
1971 final boolean deviceIsDesktopCompatible = hasDesktopGLFactory && desktopFactory.getIsDeviceCompatible(device);
1973 if( deviceIsDesktopCompatible ) {
1975 computeProfileMap(device,
true ,
true );
1979 final Thread sharedResourceThread = desktopFactory.getSharedResourceThread();
1980 final boolean initLockOwnerAdded;
1981 if(
null != sharedResourceThread) {
1982 if( !initLock.isOriginalOwner(sharedResourceThread) ) {
1983 initLock.addOwner(sharedResourceThread);
1984 initLockOwnerAdded =
true;
1986 initLockOwnerAdded =
false;
1989 initLockOwnerAdded =
false;
1991 final boolean desktopSharedCtxAvail = desktopFactory.createSharedResource(device);
1992 if( initLockOwnerAdded ) {
1993 initLock.removeOwner(sharedResourceThread);
1995 if( desktopSharedCtxAvail ) {
1996 if( !GLContext.getAvailableGLVersionsSet(device) ) {
1997 throw new InternalError(
"Available GLVersions not set for "+device);
1999 mappedDesktopProfiles = computeProfileMap(device,
false ,
false );
2000 addedDesktopProfile = mappedDesktopProfiles.size() > 0;
2002 System.err.println(
"GLProfile.initProfilesForDevice: "+device+
": desktop Shared Ctx "+desktopSharedCtxAvail+
2003 ", profiles: "+(addedDesktopProfile ? mappedDesktopProfiles.size() : 0));
2008 final boolean deviceIsMobileCompatible = hasMobileFactory && mobileFactory.getIsDeviceCompatible(device);
2011 if( deviceIsMobileCompatible ) {
2013 computeProfileMap(device,
true ,
true );
2017 final Thread sharedResourceThread = mobileFactory.getSharedResourceThread();
2018 final boolean initLockOwnerAdded;
2019 if(
null != sharedResourceThread) {
2020 if( !initLock.isOriginalOwner(sharedResourceThread) ) {
2021 initLock.addOwner(sharedResourceThread);
2022 initLockOwnerAdded =
true;
2024 initLockOwnerAdded =
false;
2027 initLockOwnerAdded =
false;
2029 final boolean eglSharedCtxAvail = mobileFactory.createSharedResource(device);
2030 if( initLockOwnerAdded ) {
2031 initLock.removeOwner(sharedResourceThread);
2033 if( eglSharedCtxAvail ) {
2034 if( !GLContext.getAvailableGLVersionsSet(device) ) {
2035 throw new InternalError(
"Available GLVersions not set for "+device);
2037 mappedEGLProfiles = computeProfileMap(device,
false ,
false );
2038 addedMobileProfile = mappedEGLProfiles.size() > 0;
2041 System.err.println(
"GLProfile.initProfilesForDevice: "+device+
": mobile Shared Ctx "+eglSharedCtxAvail+
2042 ", profiles: "+(addedMobileProfile ? mappedEGLProfiles.size() : 0));
2046 final HashMap<String, GLProfile> mappedAllProfiles;
2047 if( addedMobileProfile ) {
2051 mappedAllProfiles = mappedEGLProfiles;
2052 }
else if( addedDesktopProfile ) {
2053 mappedAllProfiles = mappedDesktopProfiles;
2055 mappedAllProfiles =
new HashMap<String , GLProfile>();
2057 System.err.println(
"GLProfile: device could not be initialized: "+device);
2058 System.err.println(
"GLProfile: compatible w/ desktop: "+deviceIsDesktopCompatible+
2059 ", mobile "+deviceIsMobileCompatible);
2060 System.err.println(
"GLProfile: desktoplFactory "+desktopFactory);
2061 System.err.println(
"GLProfile: mobileFactory "+mobileFactory);
2062 System.err.println(
"GLProfile: hasGLES1Impl "+hasGLES1Impl);
2063 System.err.println(
"GLProfile: hasGLES3Impl "+hasGLES3Impl);
2066 setProfileMap(device, mappedAllProfiles);
2068 GLContext.setAvailableGLVersionsSet(device,
true);
2071 System.err.println(
"GLProfile.initProfilesForDevice: "+device.getUniqueID()+
": added profile(s): desktop "+addedDesktopProfile+
", mobile "+addedMobileProfile);
2072 System.err.println(
"GLProfile.initProfilesForDevice: "+device.getUniqueID()+
": "+
glAvailabilityToString(device));
2073 if(addedDesktopProfile) {
2074 dumpGLInfo(desktopFactory, device);
2075 final List<GLCapabilitiesImmutable> availCaps = desktopFactory.getAvailableCapabilities(device);
2076 for(
int i=0; i<availCaps.size(); i++) {
2077 System.err.println(availCaps.get(i));
2079 }
else if(addedMobileProfile) {
2080 dumpGLInfo(mobileFactory, device);
2081 final List<GLCapabilitiesImmutable> availCaps = mobileFactory.getAvailableCapabilities(device);
2082 for(
int i=0; i<availCaps.size(); i++) {
2083 System.err.println(availCaps.get(i));
2088 return addedDesktopProfile || addedMobileProfile;
2091 private static void dumpGLInfo(
final GLDrawableFactoryImpl factory,
final AbstractGraphicsDevice device) {
2092 final GLContext ctx = factory.getOrCreateSharedContext(device);
2094 System.err.println(
"GLProfile.dumpGLInfo: "+ctx);
2095 if( GLContext.CONTEXT_NOT_CURRENT != ctx.makeCurrent() ) {
2097 System.err.println(JoglVersion.getGLInfo(ctx.getGL(),
null));
2102 System.err.println(
"GLProfile.dumpGLInfo: Couldn't make context current");
2105 System.err.println(
"GLProfile.dumpGLInfo: shared context n/a");
2106 System.err.println(device.getClass().getSimpleName()+
"[type "+
2107 device.getType()+
", connection "+device.getConnection()+
"]:");
2108 System.err.println(GLProfile.glAvailabilityToString(device,
null,
"\t", 1).toString());
2114 return defaultDevice;
2117 private static String array2String(
final String[] list) {
2118 final StringBuilder msg =
new StringBuilder();
2120 for (
int i = 0; i < list.length; i++) {
2123 msg.append(list[i]);
2126 return msg.toString();
2129 private static void glAvailabilityToString(
final AbstractGraphicsDevice device,
final StringBuilder sb,
final int major,
final int profile) {
2130 final String str = GLContext.getAvailableGLVersionAsString(device, major, profile);
2132 throw new GLException(
"Internal Error");
2139 private static HashMap<String, GLProfile> computeProfileMap(
final AbstractGraphicsDevice device,
final boolean desktopCtxUndef,
final boolean esCtxUndef) {
2141 System.err.println(
"GLProfile.init map "+device.getUniqueID()+
", desktopCtxUndef "+desktopCtxUndef+
", esCtxUndef "+esCtxUndef);
2143 final boolean isHardwareRasterizer[] =
new boolean[1];
2144 GLProfile defaultGLProfileAny =
null;
2145 GLProfile defaultGLProfileHW =
null;
2146 final HashMap<String, GLProfile> _mappedProfiles =
new HashMap<String, GLProfile>(
GL_PROFILE_LIST_ALL.length + 1 );
2149 final String profileImpl = computeProfileImpl(device, profile, desktopCtxUndef, esCtxUndef, isHardwareRasterizer);
2150 if(
null != profileImpl ) {
2151 final GLProfile glProfile;
2152 if( profile.equals( profileImpl ) ) {
2153 glProfile =
new GLProfile(profile,
null, isHardwareRasterizer[0],
false );
2155 final GLProfile _mglp = _mappedProfiles.get( profileImpl );
2156 if(
null == _mglp ) {
2159 throw new InternalError(
"XXX0 profile["+i+
"]: "+profile+
" -> profileImpl "+profileImpl+
" !!! not mapped ");
2161 glProfile =
new GLProfile(profile, _mglp, isHardwareRasterizer[0],
false );
2163 _mappedProfiles.put(profile, glProfile);
2165 System.err.println(
"GLProfile.init map "+glProfile+
" on device "+device.getUniqueID());
2167 if(
null == defaultGLProfileHW && isHardwareRasterizer[0] ) {
2168 defaultGLProfileHW=glProfile;
2170 System.err.println(
"GLProfile.init map defaultHW "+glProfile+
" on device "+device.getUniqueID());
2172 }
else if(
null == defaultGLProfileAny ) {
2173 defaultGLProfileAny=glProfile;
2175 System.err.println(
"GLProfile.init map defaultAny "+glProfile+
" on device "+device.getUniqueID());
2180 System.err.println(
"GLProfile.init map *** no mapping for "+profile+
" on device "+device.getUniqueID());
2184 if(
null != defaultGLProfileHW ) {
2185 _mappedProfiles.put(GL_DEFAULT, defaultGLProfileHW);
2186 }
else if(
null != defaultGLProfileAny ) {
2187 _mappedProfiles.put(GL_DEFAULT, defaultGLProfileAny);
2189 setProfileMap(device, _mappedProfiles);
2190 return _mappedProfiles;
2196 private static String computeProfileImpl(
final AbstractGraphicsDevice device,
final String profile,
final boolean desktopCtxUndef,
final boolean esCtxUndef,
final boolean isHardwareRasterizer[]) {
2197 final boolean hasAnyGL234Impl = hasGL234Impl || hasGL234OnMobileImpl;
2198 final boolean hardwareRasterizer[] =
new boolean[1];
2199 if (
GL2ES1 == profile ) {
2200 final boolean gles1Available;
2201 final boolean gles1HWAvailable;
2202 if( hasGLES1Impl ) {
2203 gles1Available = esCtxUndef || GLContext.isGLES1Available(device, hardwareRasterizer);
2204 gles1HWAvailable = gles1Available && hardwareRasterizer[0] ;
2206 gles1Available =
false;
2207 gles1HWAvailable =
false;
2209 if( hasAnyGL234Impl ) {
2210 final boolean gl3bcAvailable = GLContext.isGL3bcAvailable(device, hardwareRasterizer);
2211 final boolean gl3bcHWAvailable = gl3bcAvailable && hardwareRasterizer[0] ;
2212 final boolean gl2Available = GLContext.isGL2Available(device, hardwareRasterizer);
2213 final boolean gl2HWAvailable = gl2Available && hardwareRasterizer[0] ;
2214 final boolean glAnyHWAvailable = gl3bcHWAvailable || gl2HWAvailable ||
2217 if( GLContext.isGL4bcAvailable(device, isHardwareRasterizer) &&
2218 ( isHardwareRasterizer[0] || !glAnyHWAvailable ) ) {
2221 if( gl3bcAvailable && ( gl3bcHWAvailable || !glAnyHWAvailable ) ) {
2222 isHardwareRasterizer[0] = gl3bcHWAvailable;
2225 if( ( desktopCtxUndef || gl2Available ) && ( gl2HWAvailable || !glAnyHWAvailable ) ) {
2226 isHardwareRasterizer[0] = gl2HWAvailable;
2230 if( gles1Available ) {
2231 isHardwareRasterizer[0] = gles1HWAvailable;
2234 }
else if (
GL2ES2 == profile ) {
2235 final boolean gles2Available, gles3Available;
2236 final boolean gles2HWAvailable, gles3HWAvailable;
2237 if( hasGLES3Impl ) {
2238 gles2Available = esCtxUndef || GLContext.isGLES2Available(device, hardwareRasterizer);
2239 gles2HWAvailable = gles2Available && hardwareRasterizer[0] ;
2240 gles3Available = esCtxUndef || GLContext.isGLES3Available(device, hardwareRasterizer);
2241 gles3HWAvailable = gles3Available && hardwareRasterizer[0] ;
2243 gles2Available =
false;
2244 gles2HWAvailable =
false;
2245 gles3Available =
false;
2246 gles3HWAvailable =
false;
2248 if( hasAnyGL234Impl ) {
2249 final boolean gl4bcAvailable = GLContext.isGL4bcAvailable(device, hardwareRasterizer);
2250 final boolean gl4bcHWAvailable = gl4bcAvailable && hardwareRasterizer[0] ;
2251 final boolean gl3Available = GLContext.isGL3Available(device, hardwareRasterizer);
2252 final boolean gl3HWAvailable = gl3Available && hardwareRasterizer[0] ;
2253 final boolean gl3bcAvailable = GLContext.isGL3bcAvailable(device, hardwareRasterizer);
2254 final boolean gl3bcHWAvailable = gl3bcAvailable && hardwareRasterizer[0] ;
2255 final boolean gl2Available = GLContext.isGL2Available(device, hardwareRasterizer);
2256 final boolean gl2HWAvailable = gl2Available && hardwareRasterizer[0] ;
2257 final boolean glAnyHWAvailable = gl4bcHWAvailable || gl3HWAvailable || gl3bcHWAvailable || gl2HWAvailable ||
2258 gles3HWAvailable || gles2HWAvailable ;
2260 if( GLContext.isGL4Available(device, isHardwareRasterizer) &&
2261 ( isHardwareRasterizer[0] || !glAnyHWAvailable ) ) {
2264 if( gl4bcAvailable && ( gl4bcHWAvailable || !glAnyHWAvailable ) ) {
2265 isHardwareRasterizer[0] = gl4bcHWAvailable;
2268 if( gl3Available && ( gl3HWAvailable || !glAnyHWAvailable ) ) {
2269 isHardwareRasterizer[0] = gl3HWAvailable;
2272 if( gl3bcAvailable && ( gl3bcHWAvailable || !glAnyHWAvailable ) ) {
2273 isHardwareRasterizer[0] = gl3bcHWAvailable;
2276 if( ( desktopCtxUndef || gl2Available ) && ( gl2HWAvailable || !glAnyHWAvailable ) ) {
2277 isHardwareRasterizer[0] = gl2HWAvailable;
2281 if( gles3Available && ( gles3HWAvailable || !gles2HWAvailable ) ) {
2282 isHardwareRasterizer[0] = gles3HWAvailable;
2285 if( gles2Available ) {
2286 isHardwareRasterizer[0] = gles2HWAvailable;
2289 }
else if (
GL4ES3 == profile) {
2290 final boolean gles3CompatAvail = GLContext.isGLES3CompatibleAvailable(device);
2291 if( desktopCtxUndef || esCtxUndef || gles3CompatAvail ) {
2292 final boolean es3HardwareRasterizer[] =
new boolean[1];
2293 final boolean gles3Available = hasGLES3Impl && ( esCtxUndef || GLContext.isGLES3Available(device, es3HardwareRasterizer) );
2294 final boolean gles3HWAvailable = gles3Available && es3HardwareRasterizer[0] ;
2295 if( hasAnyGL234Impl ) {
2296 final boolean gl4bcAvailable = GLContext.isGL4bcAvailable(device, hardwareRasterizer);
2297 final boolean gl4bcHWAvailable = gl4bcAvailable && hardwareRasterizer[0] ;
2298 final boolean glAnyHWAvailable = gl4bcHWAvailable ||
2301 if( GLContext.isGL4Available(device, isHardwareRasterizer) &&
2302 ( isHardwareRasterizer[0] || !glAnyHWAvailable ) ) {
2305 if( ( desktopCtxUndef || gl4bcAvailable ) && ( gl4bcHWAvailable || !glAnyHWAvailable ) ) {
2306 isHardwareRasterizer[0] = gl4bcHWAvailable;
2310 if(gles3Available) {
2311 isHardwareRasterizer[0] = es3HardwareRasterizer[0];
2315 }
else if(
GL2GL3 == profile) {
2316 if( hasAnyGL234Impl ) {
2317 final boolean gl4Available = GLContext.isGL4Available(device, hardwareRasterizer);
2318 final boolean gl4HWAvailable = gl4Available && hardwareRasterizer[0] ;
2319 final boolean gl3Available = GLContext.isGL3Available(device, hardwareRasterizer);
2320 final boolean gl3HWAvailable = gl3Available && hardwareRasterizer[0] ;
2321 final boolean gl3bcAvailable = GLContext.isGL3bcAvailable(device, hardwareRasterizer);
2322 final boolean gl3bcHWAvailable = gl3bcAvailable && hardwareRasterizer[0] ;
2323 final boolean gl2Available = GLContext.isGL2Available(device, hardwareRasterizer);
2324 final boolean gl2HWAvailable = gl2Available && hardwareRasterizer[0] ;
2325 final boolean glAnyHWAvailable = gl4HWAvailable || gl3HWAvailable || gl3bcHWAvailable || gl2HWAvailable;
2327 if( GLContext.isGL4bcAvailable(device, isHardwareRasterizer) &&
2328 ( isHardwareRasterizer[0] || !glAnyHWAvailable ) ) {
2331 if( gl4Available && ( gl4HWAvailable || !glAnyHWAvailable ) ) {
2332 isHardwareRasterizer[0] = gl4HWAvailable;
2335 if( gl3bcAvailable && ( gl3bcHWAvailable || !glAnyHWAvailable ) ) {
2336 isHardwareRasterizer[0] = gl3bcHWAvailable;
2339 if( gl3Available && ( gl3HWAvailable || !glAnyHWAvailable ) ) {
2340 isHardwareRasterizer[0] = gl3HWAvailable;
2343 if( desktopCtxUndef || gl2Available ) {
2344 isHardwareRasterizer[0] = gl2HWAvailable;
2348 }
else if(
GL4bc == profile && hasAnyGL234Impl && ( desktopCtxUndef || GLContext.isGL4bcAvailable(device, isHardwareRasterizer))) {
2349 return desktopCtxUndef ?
GL4bc : GLContext.getAvailableGLProfileName(device, 4, GLContext.CTX_PROFILE_COMPAT);
2350 }
else if(
GL4 == profile && hasAnyGL234Impl && ( desktopCtxUndef || GLContext.isGL4Available(device, isHardwareRasterizer))) {
2351 return desktopCtxUndef ?
GL4 : GLContext.getAvailableGLProfileName(device, 4, GLContext.CTX_PROFILE_CORE);
2352 }
else if(
GL3bc == profile && hasAnyGL234Impl && ( desktopCtxUndef || GLContext.isGL3bcAvailable(device, isHardwareRasterizer))) {
2353 return desktopCtxUndef ?
GL3bc : GLContext.getAvailableGLProfileName(device, 3, GLContext.CTX_PROFILE_COMPAT);
2354 }
else if(
GL3 == profile && hasAnyGL234Impl && ( desktopCtxUndef || GLContext.isGL3Available(device, isHardwareRasterizer))) {
2355 return desktopCtxUndef ?
GL3 : GLContext.getAvailableGLProfileName(device, 3, GLContext.CTX_PROFILE_CORE);
2356 }
else if(
GL2 == profile && hasAnyGL234Impl && ( desktopCtxUndef || GLContext.isGL2Available(device, isHardwareRasterizer))) {
2358 if( desktopCtxUndef ) {
2361 final String gl2_impl = GLContext.getAvailableGLProfileName(device, 2, GLContext.CTX_PROFILE_COMPAT);
2362 if(
GL3bc == gl2_impl && !GLContext.isGL3bcAvailable(device, isHardwareRasterizer) ) {
2368 }
else if(
GLES3 == profile && hasGLES3Impl && ( esCtxUndef || GLContext.isGLES3Available(device, isHardwareRasterizer))) {
2369 return esCtxUndef ?
GLES3 : GLContext.getAvailableGLProfileName(device, 3, GLContext.CTX_PROFILE_ES);
2370 }
else if(
GLES2 == profile && hasGLES3Impl && ( esCtxUndef || GLContext.isGLES2Available(device, isHardwareRasterizer))) {
2371 return esCtxUndef ?
GLES2 : GLContext.getAvailableGLProfileName(device, 2, GLContext.CTX_PROFILE_ES);
2372 }
else if(
GLES1 == profile && hasGLES1Impl && ( esCtxUndef || GLContext.isGLES1Available(device, isHardwareRasterizer))) {
2373 return esCtxUndef ?
GLES1 : GLContext.getAvailableGLProfileName(device, 1, GLContext.CTX_PROFILE_ES);
2378 private static HashMap<String , HashMap<String , GLProfile>> deviceConn2ProfileMap =
2379 new HashMap<String , HashMap<String , GLProfile>>();
2392 private static HashMap<String , GLProfile> getProfileMap(AbstractGraphicsDevice device,
final boolean throwExceptionOnZeroProfile)
2397 if(
null==defaultDevice) {
2398 throw new GLException(
"No default device available");
2402 device = defaultDevice;
2406 HashMap<String , GLProfile> map = deviceConn2ProfileMap.get(deviceKey);
2410 if( !initProfilesForDevice(device) ) {
2411 if( throwExceptionOnZeroProfile ) {
2412 throw new GLException(
"No Profile available for "+device);
2417 map = deviceConn2ProfileMap.get(deviceKey);
2418 if(
null == map && throwExceptionOnZeroProfile ) {
2419 throw new InternalError(
"initProfilesForDevice(..) didn't setProfileMap(..) for "+device);
2424 private static void setProfileMap(
final AbstractGraphicsDevice device,
final HashMap<String /*GLProfile_name*/, GLProfile> mappedProfiles) {
2425 synchronized ( deviceConn2ProfileMap ) {
2426 deviceConn2ProfileMap.put(device.getUniqueID(), mappedProfiles);
2430 private GLProfile(
final String profile,
final GLProfile profileImpl,
final boolean isHardwareRasterizer,
final boolean isCustom) {
2431 this.profile = profile;
2432 this.profileImpl = profileImpl;
2433 this.isHardwareRasterizer = isHardwareRasterizer;
2434 this.isCustom = isCustom;
2438 return new GLProfile(profile, profileImpl, profileImpl.isHardwareRasterizer,
true);
2442 private final String profile;
2443 private final boolean isHardwareRasterizer;
2444 private final boolean isCustom;
Abstraction for an OpenGL rendering context.
static final int CTX_PROFILE_COMPAT
ARB_create_context related: desktop compatibility profile.
static final int CTX_PROFILE_ES
ARB_create_context related: ES profile.
static final int CTX_PROFILE_CORE
ARB_create_context related: desktop core profile.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Specifies the the OpenGL profile.
static boolean isAvailable(final AbstractGraphicsDevice device, final String profile)
Returns the availability of a profile on a device.
final boolean isGLES3()
Indicates whether this profile is capable of GLES3.
static final boolean disableSurfacelessContext
Disable surfaceless OpenGL context capability and its probing by setting the property jogl....
static GLProfile getMinimum(final boolean favorHardwareRasterizer)
Uses the default device.
static final String GLES3
The embedded OpenGL profile ES 3.x, with x >= 0.
static GLProfile getMaxFixedFunc(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer)
Returns the highest profile, implementing the fixed function pipeline.
static GLProfile getMaximum(final boolean favorHardwareRasterizer)
Uses the default device.
static final String GL2ES2
The intersection of the desktop GL3, GL2 and embedded ES2 profile.
static final boolean disableOpenGLDesktop
In case no OpenGL desktop profiles are required and if one platform may have a buggy implementation,...
static final String[] GL_PROFILE_LIST_MAX_FIXEDFUNC
Order of maximum fixed function profiles.
final boolean isGLES2()
Indicates whether this profile is capable of GLES2.
static GLProfile getGL2GL3(final AbstractGraphicsDevice device)
Returns the GL2GL3 profile implementation, hence compatible w/ GL2GL3.
static String getGLArrayName(final int array)
static final String[] GL_PROFILE_LIST_ALL
All GL Profiles in the order of default detection.
final boolean isHardwareRasterizer()
return true if impl.
static final String GL3
The desktop OpenGL core profile 3.x, with x >= 1.
static GLProfile getMaxProgrammableCore(final boolean favorHardwareRasterizer)
Uses the default device.
final boolean isGL4ES3()
Indicates whether this profile is capable of GL4ES3.
final boolean usesNativeGLES1()
Indicates whether this profile uses the native OpenGL ES1 implementations.
final String getGLImplBaseClassName()
static StringBuilder glAvailabilityToString(final AbstractGraphicsDevice device, final StringBuilder sb)
final boolean usesNativeGLES3()
Indicates whether this profile uses the native OpenGL ES3 implementations.
static final boolean disableOpenGLES
In case no OpenGL ES profiles are required and if one platform may have a buggy implementation,...
static void shutdown()
Manual shutdown method, may be called after your last JOGL use within the running JVM.
static final String GLES2
The embedded OpenGL profile ES 2.x, with x >= 0.
static final boolean enableANGLE
We have to disable support for ANGLE, the D3D ES2 emulation on Windows provided w/ Firefox and Chrome...
final boolean isGL2ES2()
Indicates whether this profile is capable of GL2ES2.
static boolean usesNativeGLES3(final String profileImpl)
Indicates whether the native OpenGL ES2 profile is in use.
final GLProfile getImpl()
return this profiles implementation, eg.
static final String[] GL_PROFILE_LIST_MAX_MOBILE
Order of maximum original mobile profiles.
static GLProfile getMaxProgrammable(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer)
Returns the highest profile, implementing the programmable shader pipeline.
static boolean usesNativeGLES(final String profileImpl)
Indicates whether either of the native OpenGL ES profiles are in use.
static final boolean disableOpenGLCore
In case no native OpenGL core profiles are required and if one platform may have a buggy implementati...
static GLProfile getMaxProgrammable(final boolean favorHardwareRasterizer)
Uses the default device.
static boolean isAWTAvailable()
static GLProfile getGL4ES3()
Calls getGL4ES3(AbstractGraphicsDevice) using the default device.
static GLProfile getDefault()
Returns a default GLProfile object, reflecting the best for the running platform.
static String glAvailabilityToString(final AbstractGraphicsDevice device)
static final String GL4bc
The desktop OpenGL compatibility profile 4.x, with x >= 0, ie GL2 plus GL4.
final boolean isGL4bc()
Indicates whether this profile is capable of GL4bc.
static final String GL2GL3
The intersection of the desktop GL3 and GL2 profile.
final boolean isGLES1()
Indicates whether this profile is capable of GLES1.
static final boolean disabledEGL
In case no EGL implementation is available like on the Platform.OSType#IOS platform,...
static GLProfile getMaximum(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer)
Returns the highest profile.
final boolean usesNativeGLES2()
Indicates whether this profile uses the native OpenGL ES2 implementations.
static GLProfile getGL2ES1()
Calls getGL2ES1(AbstractGraphicsDevice) using the default device.
final boolean isGL4()
Indicates whether this profile is capable of GL4.
final boolean isGL3ES3()
Indicates whether this profile is capable of GL3ES3.
final boolean usesNativeGLES()
Indicates whether this profile uses either of the native OpenGL ES implementations.
static GLProfile getDefault(final AbstractGraphicsDevice device)
Returns a default GLProfile object, reflecting the best for the running platform.
boolean isValidArrayDataType(final int index, final int comps, final int type, final boolean isVertexAttribPointer, final boolean throwException)
General validation if index, comps and type are valid for the current profile.
boolean isValidDataType(final int type, final boolean throwException)
General validation if type is a valid GL data type for the current profile.
static String glAvailabilityToString()
Uses the default device.
final boolean isGLES()
Indicates whether this profile is capable of GLES.
static GLProfile createCustomGLProfile(final String profile, final GLProfile profileImpl)
static boolean isAvailable(final String profile)
Returns the availability of a profile on the default device.
static GLProfile getMinimum(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer)
Returns the lowest profile.
static GLProfile getGL2ES2()
Calls getGL2ES2(AbstractGraphicsDevice) using the default device.
final boolean hasGLSL()
Indicates whether this profile supports GLSL, i.e.
final boolean isGL2GL3()
Indicates whether this profile is capable of GL2GL3.
static boolean usesNativeGLES2(final String profileImpl)
Indicates whether the native OpenGL ES3 or ES2 profile is in use.
static AbstractGraphicsDevice getDefaultDevice()
static final String[] GL_PROFILE_LIST_MAX_PROGSHADER_CORE
Order of maximum programmable shader core only profiles.
final Constructor<?> getGLCtor(final boolean glObject)
static GLProfile getGL2ES1(final AbstractGraphicsDevice device)
Returns the GL2ES1 profile implementation, hence compatible w/ GL2ES1.
static GLProfile getMaxFixedFunc(final boolean favorHardwareRasterizer)
Uses the default device.
static GLProfile getGL4ES3(final AbstractGraphicsDevice device)
Returns the GL4ES3 profile implementation, hence compatible w/ GL4ES3.
final boolean equals(final Object o)
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
static final boolean disableOpenGLARBContext
In case the implementation of the ARB_create_context context creation extension is buggy on one platf...
static final String GL3bc
The desktop OpenGL compatibility profile 3.x, with x >= 1, ie GL2 plus GL3.
static final String GL2
The desktop OpenGL profile 1.x up to 3.0.
static final boolean DEBUG
static final String[] GL_PROFILE_LIST_MAX
Order of maximum profiles.
final boolean isGL2ES1()
Indicates whether this profile is capable of GL2ES1.
static GLProfile getMaxProgrammableCore(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer)
Returns the highest profile, implementing the programmable shader core pipeline only.
static boolean isAnyAvailable()
Returns the availability of any profile on the default device.
final boolean isGL3bc()
Indicates whether this profile is capable of GL3bc.
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
static String getGLTypeName(final int type)
static final String[] GL_PROFILE_LIST_MIN
Order of minimum profiles.
static boolean isInitialized()
final void verifyEquality(final GLProfile glp)
static GLProfile getGL2GL3()
Calls getGL2GL3(AbstractGraphicsDevice) using the default device.
static final String GLES1
The embedded OpenGL profile ES 1.x, with x >= 0.
final String getImplName()
return this profiles implementation name, eg.
static final String[] GL_PROFILE_LIST_MAX_PROGSHADER
Order of maximum programmable shader profiles.
static final String[] GL_PROFILE_LIST_MIN_DESKTOP
Order of minimum original desktop profiles.
static final String GL4ES3
The intersection of the desktop GL4 and ES3 profile, available only if either ES3 or GL4 w/ GL_ARB_ES...
static void initSingleton()
Static initialization of JOGL.
static final String GL4
The desktop OpenGL core profile 4.x, with x >= 0.
static boolean usesNativeGLES1(final String profileImpl)
Indicates whether the native OpenGL ES1 profile is in use.
final boolean isGL3()
Indicates whether this profile is capable of GL3.
final boolean isGL2ES3()
Indicates whether this profile is capable of GL2ES3.
final boolean isGL2()
Indicates whether this profile is capable of GL2 .
static final String GL2ES1
The intersection of the desktop GL2 and embedded ES1 profile.
static void initProfiles(final AbstractGraphicsDevice device)
Trigger eager initialization of GLProfiles for the given device, in case it isn't done yet.
final String getName()
return this profiles name
static StringBuilder glAvailabilityToString(AbstractGraphicsDevice device, StringBuilder sb, final String indent, int indentCount)
static StringBuilder getDefaultOpenGLInfo(AbstractGraphicsDevice device, StringBuilder sb, final boolean withCapabilitiesInfo)
A interface describing a graphics device in a toolkit-independent manner.
String getUniqueID()
Returns a unique ID object of this device using type, connection and unitID as it's key components.
static final int GL_INT_2_10_10_10_REV
GL_ARB_vertex_type_2_10_10_10_rev, GL_VERSION_3_3, GL_ES_VERSION_3_0 Define "GL_INT_2_10_10_10_REV" w...
static final int GL_UNSIGNED_INT_10F_11F_11F_REV
Part of GL_ES_VERSION_3_0, GL_VERSION_3_0; GL_EXT_packed_float
static final int GL_FIXED
GL_ARB_ES2_compatibility, GL_ES_VERSION_2_0, GL_VERSION_4_1, GL_VERSION_ES_1_0, GL_OES_fixed_point Al...
static final int GL_SHORT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_SHORT" with expressio...
static final int GL_UNSIGNED_INT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_OES_element_index_uint Define "GL_UNSIGNED_INT"...
static final int GL_FLOAT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_FLOAT" with expressio...
static final int GL_UNSIGNED_SHORT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_UNSIGNED_SHORT" with ...
static final int GL_HALF_FLOAT
Part of GL_ARB_half_float_vertex; GL_NV_half_float; GL_ARB_half_float_pixel, earmarked for ES 3....
static final int GL_UNSIGNED_BYTE
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_UNSIGNED_BYTE" with e...
static final int GL_BYTE
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_BYTE" with expression...
static final int GL_COLOR_ARRAY
static final int GL_TEXTURE_COORD_ARRAY
static final int GL_VERTEX_ARRAY
static final int GL_NORMAL_ARRAY