38package com.jogamp.opengl;
40import java.nio.IntBuffer;
41import java.util.HashMap;
42import java.util.IdentityHashMap;
43import java.util.Iterator;
47import com.jogamp.common.os.DynamicLibraryBundle;
48import com.jogamp.common.os.Platform;
49import com.jogamp.common.util.Bitfield;
50import com.jogamp.common.util.VersionNumber;
51import com.jogamp.common.util.VersionNumberString;
52import com.jogamp.common.util.locks.LockFactory;
53import com.jogamp.common.util.locks.RecursiveLock;
54import com.jogamp.nativewindow.AbstractGraphicsDevice;
55import com.jogamp.nativewindow.NativeSurface;
57import jogamp.opengl.Debug;
58import jogamp.opengl.GLContextImpl;
59import jogamp.opengl.GLContextShareSet;
60import jogamp.opengl.GLDynamicLookupHelper;
76 public static final boolean DEBUG = Debug.debug(
"GLContext");
77 public static final boolean TRACE_SWITCH = Debug.isPropertyDefined(
"jogl.debug.GLContext.TraceSwitch",
true);
104 public static final boolean PROFILE_ALIASING = !Debug.isPropertyDefined(
"jogl.debug.GLContext.NoProfileAliasing",
true);
107 public static final boolean DEBUG_GL = Debug.isPropertyDefined(
"jogl.debug.DebugGL",
true);
109 public static final boolean TRACE_GL = Debug.isPropertyDefined(
"jogl.debug.TraceGL",
true);
119 public static final VersionNumber
Version1_0 =
new VersionNumber(1, 0, 0);
121 public static final VersionNumber
Version1_10 =
new VersionNumber(1, 10, 0);
123 public static final VersionNumber
Version1_20 =
new VersionNumber(1, 20, 0);
125 public static final VersionNumber
Version1_30 =
new VersionNumber(1, 30, 0);
127 public static final VersionNumber
Version1_40 =
new VersionNumber(1, 40, 0);
129 public static final VersionNumber
Version1_50 =
new VersionNumber(1, 50, 0);
132 public static final VersionNumber
Version1_1 =
new VersionNumber(1, 1, 0);
135 public static final VersionNumber
Version1_2 =
new VersionNumber(1, 2, 0);
138 public static final VersionNumber
Version1_4 =
new VersionNumber(1, 4, 0);
141 public static final VersionNumber
Version1_5 =
new VersionNumber(1, 5, 0);
144 public static final VersionNumber
Version3_0 =
new VersionNumber(3, 0, 0);
147 public static final VersionNumber
Version3_1 =
new VersionNumber(3, 1, 0);
150 public static final VersionNumber
Version3_2 =
new VersionNumber(3, 2, 0);
153 public static final VersionNumber
Version4_3 =
new VersionNumber(4, 3, 0);
155 protected static final VersionNumber
Version8_0 =
new VersionNumber(8, 0, 0);
157 private static final String S_EMPTY =
"";
217 private static final ThreadLocal<GLContext> currentContext =
new ThreadLocal<GLContext>();
219 private final HashMap<String, Object> attachedObjects =
new HashMap<String, Object>();
222 protected final RecursiveLock
lock = LockFactory.createRecursiveLock();
246 System.err.println(
getThreadName() +
": GLContext.resetStates(isInit "+isInit+
")");
254 attachedObjects.clear();
262 return GLContextShareSet.isShared(
this);
278 return GLContextShareSet.getCreatedShares(
this);
283 return GLContextShareSet.getDestroyedShares(
this);
516 return currentContext.get();
541 default:
return "INVALID_VALUE";
553 System.err.println(
getThreadName()+
": GLContext.ContextSwitch: - setCurrent() - NULL");
558 currentContext.set(cur);
612 return attachedObjects.get(name);
619 public final Object
attachObject(
final String name,
final Object obj) {
620 return attachedObjects.put(name, obj);
624 return attachedObjects.remove(name);
632 final StringBuilder sb =
new StringBuilder();
633 sb.append(getClass().getSimpleName());
637 return sb.toString();
640 public final StringBuilder
append(
final StringBuilder sb) {
642 sb.append(
"], options 0x");
644 sb.append(
", this ");
646 sb.append(
", handle ");
648 sb.append(
", isShared "+
isShared()+
", ");
650 sb.append(
",\n\t quirks: ");
657 sb.append(
",\n\tRead Drawable : ");
659 sb.append(
",\n\tWrite Drawable: ");
662 sb.append(
",\n\tDrawable: ");
823 public final VersionNumber getGLSLVersionNumber() {
853 final String profileOpt;
861 throw new InternalError(
"Neither ES, Core nor Compat: "+
this);
863 return "#version " +
ctxGLSLVersion.getMajor() + ( minor < 10 ?
"0"+minor : minor ) + profileOpt +
"\n" ;
868 if( 3 == glMajorVersion ) {
870 }
else if( 2 == glMajorVersion ) {
873 }
else if( 1 == glMajorVersion ) {
875 }
else if( 2 == glMajorVersion ) {
876 switch ( glMinorVersion ) {
880 }
else if( 3 == glMajorVersion && 2 >= glMinorVersion ) {
881 switch ( glMinorVersion ) {
888 return new VersionNumber(glMajorVersion, glMinorVersion * 10, 0);
1008 final int[] val =
new int[] { 0 } ;
1015 System.err.println(
"GLContext.getMaxRenderbufferSamples: GL_MAX_SAMPLES query GL Error 0x"+Integer.toHexString(glerr));
1017 }
catch (
final GLException gle) { gle.printStackTrace(); }
1189 return 2 == major || 3 == major;
1277 throw new InternalError(
"Implemented in GLContextImpl");
1281 throw new InternalError(
"Implemented in GLContextImpl");
1298 throw new InternalError(
"Implemented in GLContextImpl");
1303 throw new InternalError(
"Implemented in GLContextImpl");
1307 final int[] maxBarriers,
final int maxBarriers_offset) {
1312 final int[] maxBarriers,
final int maxBarriers_offset) {
return false; }
1507 public abstract void glDebugMessageControl(
int source,
int type,
int severity,
int count, IntBuffer ids,
boolean enabled);
1514 public abstract void glDebugMessageControl(
int source,
int type,
int severity,
int count,
int[] ids,
int ids_offset,
boolean enabled);
1525 { 0, 1, 2, 3, 4, 5 },
1528 { 0, 1, 2, 3, 4, 5, 6 } };
1540 public static final int getMaxMinor(
final int ctxProfile,
final int major) {
1578 public static final boolean isValidGLVersion(
final int ctxProfile,
final int major,
final int minor) {
1579 if( 1>major || 0>minor ) {
1586 if( major >=
ES_VERSIONS.length + 1 )
return false;
1597 public static final boolean clipGLVersion(
final int ctxProfile,
final int major[],
final int minor[]) {
1598 final int m = major[0];
1599 final int n = minor[0];
1603 major[0] = ES_VERSIONS.length - 1;
1612 major[0] = GL_VERSIONS.length - 1;
1636 public static final boolean decrementGLVersion(
final int ctxProfile,
final int major[],
final int minor[]) {
1639 int n = minor[0] - 1;
1662 protected static int composeBits(
final int a8,
final int b8,
final int c16) {
1663 return ( ( a8 & 0x000000FF ) << 24 ) |
1664 ( ( b8 & 0x000000FF ) << 16 ) |
1665 ( ( c16 & 0x0000FFFF ) ) ;
1667 protected static VersionNumber
decomposeBits(
final int bits32,
final int[] ctp) {
1668 final int major = ( bits32 & 0xFF000000 ) >>> 24 ;
1669 final int minor = ( bits32 & 0x00FF0000 ) >>> 16 ;
1670 ctp[0] = ( bits32 & 0x0000FFFF ) ;
1671 return new VersionNumber(major, minor, 0);
1674 return ( bits32 & 0x0000FFFF );
1683 throw new GLException(
"Internal Error: "+argName+
": 1 != num-profiles: "+num);
1699 private static final IdentityHashMap<String, String> deviceVersionsAvailableSet =
new IdentityHashMap<String, String>();
1704 deviceVersionsAvailableSet.clear();
1705 GLContextImpl.shutdownImpl();
1709 synchronized ( deviceVersionsAvailableSet ) {
1710 return deviceVersionsAvailableSet.containsKey(device.
getUniqueID());
1715 synchronized ( deviceVersionsAvailableSet ) {
1718 deviceVersionsAvailableSet.put(devKey, devKey);
1720 deviceVersionsAvailableSet.remove(devKey);
1723 System.err.println(
getThreadName() +
": createContextARB-MapGLVersions SET "+devKey);
1740 sb =
new StringBuilder();
1744 boolean needsSeparator =
false;
1745 for(
final Iterator<String> keyI = keys.iterator(); keyI.hasNext(); ) {
1746 if(needsSeparator) {
1747 sb.append(Platform.getNewline());
1749 final String key = keyI.next();
1750 sb.append(
"MapGLVersions ").append(key).append(
": ");
1753 final int[] ctp = { 0 };
1754 final VersionNumber version =
decomposeBits(valI.intValue(), ctp);
1759 needsSeparator =
true;
1788 final int[] major,
final int minor[],
final int ctp[]) {
1795 final int bits32 = valI.intValue();
1798 major[0] = ( bits32 & 0xFF000000 ) >>> 24 ;
1801 minor[0] = ( bits32 & 0x00FF0000 ) >>> 16 ;
1804 ctp[0] = ( bits32 & 0x0000FFFF ) ;
1813 protected static String
getGLProfile(
final int major,
final int minor,
final int ctp)
1821 else if(major == 3 && minor >= 1) {
return GLProfile.
GL3; }
1835 if( glpImpl.
isGL4() ) {
1839 }
else if (glpImpl.
isGLES1()) {
1846 }
else if( glpImpl.
isGL2() ) {
1859 final int[] reqMajorCTP =
new int[] { 0, 0 };
1862 final int _major[] = { 0 };
1863 final int _minor[] = { 0 };
1864 final int _ctp[] = { 0 };
1879 final String glpName = getAvailableGLProfileName(device, reqMajor, reqProfile);
1880 return null != glpName ?
GLProfile.
get(device, glpName) :
null;
1889 static String getAvailableGLProfileName(
final AbstractGraphicsDevice device,
final int reqMajor,
final int reqProfile)
1891 final int major[] = { 0 };
1892 final int minor[] = { 0 };
1893 final int ctp[] = { 0 };
1894 if(
GLContext.getAvailableGLVersion(device, reqMajor, reqProfile, major, minor, ctp)) {
1895 return GLContext.getGLProfile(major[0], minor[0], ctp[0]);
1906 final int _major[] = { 0 };
1907 final int _minor[] = { 0 };
1908 final int _ctp[] = { 0 };
1910 return getGLVersion(_major[0], _minor[0], _ctp[0],
null);
1962 isHardware[0] = 0 == ( valI.intValue() & GLContext.CTX_IMPL_ACCEL_SOFT ) ;
1979 final int major[] = { 0 };
1980 final int minor[] = { 0 };
1981 final int ctp[] = { 0 };
1984 ok =
GLContext.getAvailableGLVersion(device, 3,
GLContext.CTX_PROFILE_ES, major, minor, ctp);
1986 ok =
GLContext.getAvailableGLVersion(device, 3,
GLContext.CTX_PROFILE_CORE, major, minor, ctp);
1989 GLContext.getAvailableGLVersion(device, 3,
GLContext.CTX_PROFILE_COMPAT, major, minor, ctp);
2048 protected static StringBuilder
getGLProfile(
final StringBuilder sb,
final int ctp) {
2049 boolean needColon =
false;
2050 needColon = appendString(sb,
"ES profile", needColon, 0 != (
CTX_PROFILE_ES & ctp ));
2051 needColon = appendString(sb,
"Compat profile", needColon, 0 != (
CTX_PROFILE_COMPAT & ctp ));
2052 needColon = appendString(sb,
"Core profile", needColon, 0 != (
CTX_PROFILE_CORE & ctp ));
2053 needColon = appendString(sb,
"forward", needColon, 0 != (
CTX_OPTION_FORWARD & ctp ));
2055 needColon = appendString(sb,
"debug", needColon, 0 != (
CTX_OPTION_DEBUG & ctp ));
2056 needColon = appendString(sb,
"compat[", needColon,
true);
2066 needColon = appendString(sb,
"]", needColon,
true);
2067 needColon = appendString(sb,
"FBO", needColon, 0 != (
CTX_IMPL_FBO & ctp ));
2069 needColon = appendString(sb,
"software", needColon,
true);
2071 needColon = appendString(sb,
"hardware", needColon,
true);
2075 protected static StringBuilder
getGLVersion(
final StringBuilder sb,
final VersionNumber version,
final int ctp,
final String gl_version) {
2076 return getGLVersion(sb, version.getMajor(), version.getMinor(), ctp, gl_version);
2078 protected static StringBuilder
getGLVersion(
final StringBuilder sb,
final int major,
final int minor,
final int ctp,
final String gl_version) {
2085 if(
null!=gl_version) {
2087 sb.append(gl_version);
2091 protected static String
getGLVersion(
final int major,
final int minor,
final int ctp,
final String gl_version) {
2092 return getGLVersion(
new StringBuilder(), major, minor, ctp, gl_version).toString();
2100 return "0x" + Integer.toHexString(hex);
2104 return "0x" + Long.toHexString(hex);
2107 private static boolean appendString(
final StringBuilder sb,
final String
string,
boolean needColon,
final boolean condition) {
2118 protected static String
getThreadName() {
return Thread.currentThread().getName(); }
Abstraction for an OpenGL rendering context.
final boolean isShared()
Returns true if this GLContext is shared, otherwise false.
static final boolean decrementGLVersion(final int ctxProfile, final int major[], final int minor[])
Decrement the given GL version by one and return true if still valid, otherwise false.
abstract void copy(GLContext source, int mask)
Copies selected groups of OpenGL state variables from the supplied source context into this one.
final boolean isGLES()
Indicates whether this GLContext is capable of GLES.
boolean bindSwapBarrierImpl(final int group, final int barrier)
final boolean isGLES31Compatible()
Return true if this context is an ES3 context ≥ 3.1 or implements the extension GL_ARB_ES3_1_compatib...
final boolean isGLForwardCompatible()
void setDefaultSwapInterval()
static final boolean isGLES3CompatibleAvailable(final AbstractGraphicsDevice device)
Returns true if a ES3 compatible profile is available, i.e.
abstract int getBoundFramebuffer(int target)
Return the framebuffer name bound to this context, see GL#glBindFramebuffer(int, int).
static final int CTX_IMPL_FP32_COMPAT_API
Context supports OES_single_precision, fp32, fixed function point (FFP) compatibility entry points,...
final StringBuilder append(final StringBuilder sb)
static final VersionNumber Version4_3
Version 4.3.
static final boolean isValidGLVersion(final int ctxProfile, final int major, final int minor)
Returns true, if the major.minor is not inferior to the lowest valid version and does not exceed the ...
abstract GLDrawable getGLDrawable()
Returns the write-drawable this context uses for framebuffer operations.
abstract void setContextCreationFlags(int flags)
static final int CONTEXT_NOT_CURRENT
Indicates that the context was not made current during the last call to makeCurrent,...
final boolean isGL2()
Indicates whether this GLContext is capable of GL2.
boolean queryMaxSwapGroupsImpl(final int[] maxGroups, final int maxGroups_offset, final int[] maxBarriers, final int maxBarriers_offset)
static final VersionNumber Version1_0
Version 1.00, i.e.
abstract int getDefaultReadBuffer()
Returns the default color buffer within the current bound getDefaultReadFramebuffer(),...
final boolean isGLDebugEnabled()
static final int CTX_IMPL_ES2_COMPAT
GL_ARB_ES2_compatibility implementation related: Context is compatible w/ ES2.
static GLContext getCurrent()
Returns this thread current context.
static final int CTX_IMPL_CACHE_MASK
Context option bits, cached bit mask covering 10 bits [0..9], i.e.
static GLProfile getAvailableGLProfile(final AbstractGraphicsDevice device, final int reqMajor, final int reqProfile)
final boolean isGL4bc()
Indicates whether this GLContext is capable of GL4bc.
static StringBuilder dumpAvailableGLVersions(StringBuilder sb)
static String toHexString(final int hex)
abstract int makeCurrent()
Makes this GLContext current on the calling thread.
static final VersionNumber Version1_10
Version 1.10, i.e.
static final boolean isGLES31CompatibleAvailable(final AbstractGraphicsDevice device)
Returns true if a ES3 ≥ 3.1 compatible profile is available, i.e.
final boolean isCreated()
Indicates whether the underlying native OpenGL context has been created.
boolean isTextureFormatBGRA8888Available()
final String getGLSLVersionString()
Returns the matching GLSL version number, queried by this context GL via GL2ES2#GL_SHADING_LANGUAGE_V...
static void validateProfileBits(final int bits, final String argName)
static int composeBits(final int a8, final int b8, final int c16)
abstract boolean isGLDebugMessageEnabled()
abstract boolean isGLDebugSynchronous()
VersionNumberString ctxVendorVersion
final boolean hasFullFBOSupport()
Returns true if full FBO support is available, otherwise false.
static final boolean DEBUG_TRACE_SWITCH
static final int getAvailableContextProperties(final AbstractGraphicsDevice device, final GLProfile glp)
abstract int getDefaultDrawFramebuffer()
Return the default draw framebuffer name.
static final int CONTEXT_CURRENT
Indicates that the context was made current during the last call to makeCurrent, value {@value}.
static boolean isGL3Available(final AbstractGraphicsDevice device, final boolean isHardware[])
static StringBuilder getGLProfile(final StringBuilder sb, final int ctp)
static final VersionNumber Version1_30
Version 1.30, i.e.
static String getGLProfile(final int major, final int minor, final int ctp)
returns the highest GLProfile string regarding the implementation version and context profile bits.
final boolean joinSwapGroup(final int group)
static final int CTX_PROFILE_COMPAT
ARB_create_context related: desktop compatibility profile.
final boolean isGL2GL3()
Indicates whether this GLContext is capable of GL2GL3.
final int getMaxRenderbufferSamples()
Returns the maximum number of FBO RENDERBUFFER samples if full FBO is supported, otherwise false.
final boolean isGLES32Compatible()
Return true if this context is an ES3 context ≥ 3.2 or implements the extension GL_ARB_ES3_2_compatib...
static final boolean clipGLVersion(final int ctxProfile, final int major[], final int minor[])
Clip the given GL version to the maximum known valid version if exceeding.
static Integer getAvailableGLVersion(final AbstractGraphicsDevice device, final int reqMajor, final int reqProfile)
abstract void addGLDebugListener(GLDebugListener listener)
Add GLDebugListener.
static String getDeviceVersionAvailableKey(final AbstractGraphicsDevice device, final int major, final int profile)
Returns a unique String object using String#intern() for the given arguments, which object reference ...
abstract GL setGL(GL gl)
Sets the GL pipeline object for this GLContext.
final GLContext getSharedMaster()
Returns the shared master GLContext of this GLContext if shared, otherwise return null.
final List< GLContext > getDestroyedShares()
Returns a new list of destroyed GLContext shared with this GLContext.
static boolean isGLES2Available(final AbstractGraphicsDevice device, final boolean isHardware[])
final boolean isGL4core()
Indicates whether this GLContext uses a GL4 core profile.
final boolean isGL3()
Indicates whether this GLContext is capable of GL3.
static final VersionNumber Version1_20
Version 1.20, i.e.
static final boolean DEBUG_GL
Reflects property jogl.debug.DebugGL.
boolean isNPOTTextureAvailable()
Note: The GL impl.
static boolean isGLVersionAvailable(final AbstractGraphicsDevice device, final int reqMajor, final int reqProfile, final boolean isHardware[])
final boolean isCreatedWithARBMethod()
final boolean isGL2ES2()
Indicates whether this GLContext is capable of GL2ES2.
static final String makeCurrentResultToString(final int res)
Returns a String representation of the makeCurrent() result.
static final VersionNumber Version1_2
Version 1.2, i.e.
static final VersionNumber Version1_50
Version 1.50, i.e.
abstract int getDefaultPixelDataFormat()
Get the default pixel data format, as required by e.g.
abstract int getDefaultDrawBuffer()
Returns the default color buffer within the current bound getDefaultReadFramebuffer(),...
final boolean isGLES3Compatible()
Return true if this context is an ES3 context or implements the extension GL_ARB_ES3_compatibility,...
static boolean isGL4bcAvailable(final AbstractGraphicsDevice device, final boolean isHardware[])
VersionNumber ctxGLSLVersion
abstract void setGLDebugSynchronous(boolean synchronous)
Enables or disables the synchronous debug behavior via glEnable/glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS...
static boolean getAvailableGLVersionsSet(final AbstractGraphicsDevice device)
static final int CTX_IMPL_ES31_COMPAT
GL_ARB_ES3_1_compatibility implementation related: Context is compatible w/ ES 3.1.
static boolean isGL3bcAvailable(final AbstractGraphicsDevice device, final boolean isHardware[])
static final VersionNumber Version1_40
Version 1.40, i.e.
final boolean hasBasicFBOSupport()
Returns true if basic FBO support is available, otherwise false.
final Object getAttachedObject(final String name)
Returns the attached user object for the given name to this GLContext.
abstract void release()
Releases control of this GLContext from the current thread.
boolean joinSwapGroupImpl(final int group)
abstract boolean isFunctionAvailable(String glFunctionName)
Returns true if the specified OpenGL core- or extension-function can be successfully called using thi...
static final VersionNumber Version8_0
final boolean isGLCoreProfile()
static String toHexString(final long hex)
static final VersionNumber Version3_0
Version 3.0.
static final int getMaxMajor(final int ctxProfile)
abstract void enableGLDebugMessage(boolean enable)
Enables or disables the GLDebugOutput feature of extension GLExtensions#ARB_debug_output or GLExtensi...
static final int GL_VERSIONS[][]
abstract DynamicLibraryBundle getDynamicLibraryBundle()
Returns the DynamicLibraryBundle, matching context.
abstract String getGLExtensionsString()
Returns a non-null (but possibly empty) string containing the space-separated list of available exten...
static final boolean DEBUG
boolean setSwapInterval(final int interval)
Set the swap interval of the current context and attached onscreen GLDrawable.
static final int CTX_IMPL_FBO
Context supports basic FBO, details see hasBasicFBOSupport().
final Object detachObject(final String name)
final boolean bindSwapBarrier(final int group, final int barrier)
static final int isHardwareRasterizer(final AbstractGraphicsDevice device, final GLProfile glp)
static final int CTX_OPTION_FORWARD
ARB_create_context related: flag forward compatible.
final boolean isGLESProfile()
final boolean hasRendererQuirk(final int quirk)
Returns true if the quirk exist in getRendererQuirks(), otherwise false.
static final VersionNumber getStaticGLSLVersionNumber(final int glMajorVersion, final int glMinorVersion, final int ctxOptions)
boolean setSwapIntervalImpl(final int interval)
void resetStates(final boolean isInit)
boolean drawableRetargeted
Did the drawable association changed ? see GLRendererQuirks#NoSetSwapIntervalPostRetarget.
final Object attachObject(final String name, final Object obj)
Sets the attached user object for the given name to this GLContext.
static String getAvailableGLVersionAsString(final AbstractGraphicsDevice device, final int major, final int profile)
abstract void destroy()
Destroys this OpenGL context and frees its associated resources.
static final VersionNumber Version1_1
Version 1.1, i.e.
abstract void removeGLDebugListener(GLDebugListener listener)
Remove GLDebugListener.
final List< GLContext > getCreatedShares()
Returns a new list of created GLContext shared with this GLContext.
static final VersionNumber Version3_2
Version 3.2.
abstract void glDebugMessageControl(int source, int type, int severity, int count, IntBuffer ids, boolean enabled)
Generic entry for GL2GL3#glDebugMessageControl(int, int, int, int, IntBuffer, boolean) and GL2GL3#glD...
static final VersionNumber Version1_5
Version 1.5, i.e.
final boolean isGL3ES3()
Indicates whether this GLContext is capable of GL3ES3.
final boolean isGLES2()
Indicates whether this GLContext is capable of GLES2.
final void validateCurrent()
static boolean getAvailableGLVersion(final AbstractGraphicsDevice device, final int reqMajor, final int reqProfile, final int[] major, final int minor[], final int ctp[])
abstract GL getRootGL()
Returns the implementing root GL instance of this GLContext's GL object, considering a wrapped pipeli...
final boolean hasFP32CompatAPI()
Returns true if OES_single_precision, fp32, fixed function point (FFP) compatibility entry points ava...
String toString()
Classname, GL, GLDrawable.
final boolean isGL2ES3()
Indicates whether this GLContext is capable of GL2ES3.
static final int getMaxMinor(final int ctxProfile, final int major)
static final boolean isGLES32CompatibleAvailable(final AbstractGraphicsDevice device)
Returns true if a ES3 ≥ 3.2 compatible profile is available, i.e.
static String getGLVersion(final int major, final int minor, final int ctp, final String gl_version)
static boolean isGL4Available(final AbstractGraphicsDevice device, final boolean isHardware[])
static final int CTX_IMPL_FULL_MASK
Context option bits, full bit mask covering 16 bits [0..15], i.e.
final boolean isCPUDataSourcingAvail()
Indicates whether this GLContext allows CPU data sourcing (indices, vertices ..) as opposed to using ...
static void setCurrent(final GLContext cur)
Sets the thread-local variable returned by getCurrent and has no other side-effects.
final boolean isGLES3()
Indicates whether this GLContext is capable of GLES3.
final VersionNumber getGLVersionNumber()
Returns this context OpenGL version.
abstract String getGLDebugMessageExtension()
final GLRendererQuirks getRendererQuirks()
Returns the instance of GLRendererQuirks, allowing one to determine workarounds.
static final int CTX_IMPL_ES3_COMPAT
GL_ARB_ES3_compatibility implementation related: Context is compatible w/ ES3.
static boolean isGLES3Available(final AbstractGraphicsDevice device, final boolean isHardware[])
static final boolean isFBOAvailable(final AbstractGraphicsDevice device, final GLProfile glp)
Returns true if it is possible to create an framebuffer object (FBO).
static boolean isGL2Available(final AbstractGraphicsDevice device, final boolean isHardware[])
abstract int getDefaultPixelDataType()
Get the default pixel data type, as required by e.g.
static final int CTX_OPTION_DEBUG
ARB_create_context related: flag debug.
final boolean isGL3core()
Indicates whether this GLContext uses a GL3 core profile.
static final void getRequestMajorAndCompat(final GLProfile glp, final int[] reqMajorCTP)
Returns the GLProfile's major version number at reqMajorCTP[0] and it's context property (CTP) at req...
abstract int getContextCreationFlags()
abstract GL getGL()
Returns the GL pipeline object for this GLContext.
static final VersionNumber Version3_1
Version 3.1.
static final VersionNumber Version1_4
Version 1.4, i.e.
static final IdentityHashMap< String, Integer > deviceVersionAvailable
final VersionNumberString getGLVendorVersionNumber()
Returns the vendor's version, i.e.
static boolean isGLES1Available(final AbstractGraphicsDevice device, final boolean isHardware[])
static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device, final boolean set)
static void shutdown()
clears the device/context mappings as well as the GL/GLX proc address tables.
final boolean hasNoDefaultVAO()
Indicates whether this GLContext's native profile does not implement a default vertex array object (V...
abstract GLDrawable setGLReadDrawable(GLDrawable read)
Set the read-Drawable for read framebuffer operations.
int getSwapInterval()
Return the current swap interval.
static final int CTX_PROFILE_ES
ARB_create_context related: ES profile.
static final boolean TRACE_GL
Reflects property jogl.debug.TraceGL.
final boolean isGLES2Compatible()
static final int CTX_IS_ARB_CREATED
ARB_create_context related: created via ARB_create_context.
static final int CTX_IMPL_ES32_COMPAT
GL_ARB_ES3_2_compatibility implementation related: Context is compatible w/ ES 3.2.
static final int CONTEXT_CURRENT_NEW
Indicates that a newly-created context was made current during the last call to makeCurrent,...
final boolean isGL2ES1()
Indicates whether this GLContext is capable of GL2ES1.
final long getHandle()
Returns the underlying native OpenGL context handle.
static GL getCurrentGL()
Returns the GL object bound to this thread current context.
abstract String getPlatformExtensionsString()
Returns a non-null (but possibly empty) string containing the space-separated list of available platf...
final boolean isGLcore()
Indicates whether this GLContext uses a GL core profile.
final boolean isGLES1()
Indicates whether this GLContext is capable of GLES1.
abstract GLDrawable setGLDrawable(GLDrawable readWrite, boolean setWriteOnly)
Sets the read/write drawable for framebuffer operations, i.e.
volatile long contextHandle
The underlying native OpenGL context.
final String getGLVersion()
Returns a valid OpenGL version string, ie
static final int CTX_PROFILE_CORE
ARB_create_context related: desktop core profile.
final boolean isGL4()
Indicates whether this GLContext is capable of GL4.
abstract boolean isExtensionAvailable(String glExtensionName)
Returns true if the specified OpenGL extension can be successfully called using this GL context given...
final boolean isGL3bc()
Indicates whether this GLContext is capable of GL3bc.
final boolean isGLCompatibilityProfile()
abstract int getDefaultVAO()
If this GLContext does not implement a default VAO, see hasNoDefaultVAO(), an own default VAO will be...
static StringBuilder getGLVersion(final StringBuilder sb, final int major, final int minor, final int ctp, final String gl_version)
static StringBuilder getGLVersion(final StringBuilder sb, final VersionNumber version, final int ctp, final String gl_version)
abstract void glDebugMessageControl(int source, int type, int severity, int count, int[] ids, int ids_offset, boolean enabled)
Generic entry for GL2GL3#glDebugMessageControl(int, int, int, int, int[], int, boolean) and GL2GL3#gl...
static final boolean TRACE_SWITCH
static int getCTPFromBits(final int bits32)
final boolean isGL4ES3()
Returns true if this profile is capable of GL4ES3, i.e.
abstract int getGLExtensionCount()
Returns the number of OpenGL extensions.
static final int ES_VERSIONS[][]
final boolean isHardwareRasterizer()
final boolean queryMaxSwapGroups(final int[] maxGroups, final int maxGroups_offset, final int[] maxBarriers, final int maxBarriers_offset)
abstract GLDrawable getGLReadDrawable()
Returns the read-Drawable this context uses for read framebuffer operations.
static VersionNumber decomposeBits(final int bits32, final int[] ctp)
static final boolean PROFILE_ALIASING
If true (default), bootstrapping the available GL profiles will use the highest compatible GL context...
GLRendererQuirks glRendererQuirks
final boolean isCurrent()
abstract boolean isGLReadDrawableAvailable()
Query whether using a distinguished read-drawable is supported.
abstract int getPlatformExtensionCount()
Returns the number of platform extensions.
abstract void glDebugMessageInsert(int source, int type, int id, int severity, String buf)
Generic entry for GL2GL3#glDebugMessageInsert(int, int, int, int, int, String) and GL2GL3#glDebugMess...
static final int CTX_IMPL_ACCEL_SOFT
Context uses software rasterizer, otherwise hardware rasterizer.
abstract int getDefaultReadFramebuffer()
Return the default read framebuffer name.
static String getThreadName()
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Class holding OpenGL extension strings, commonly used by JOGL's implementation.
static final String ARB_framebuffer_object
static final String ARB_texture_non_power_of_two
static final String EXT_texture_format_BGRA8888
static final String EXT_packed_depth_stencil
static final String IMG_texture_format_BGRA8888
static final String EXT_framebuffer_object
static final String EXT_framebuffer_blit
static final String EXT_framebuffer_multisample
Specifies the the OpenGL profile.
final boolean isGLES3()
Indicates whether this profile is capable of GLES3.
static final String GLES3
The embedded OpenGL profile ES 3.x, with x >= 0.
static final String GL3
The desktop OpenGL core profile 3.x, with x >= 1.
static final String GLES2
The embedded OpenGL profile ES 2.x, with x >= 0.
final GLProfile getImpl()
return this profiles implementation, eg.
static final String GL4bc
The desktop OpenGL compatibility profile 4.x, with x >= 0, ie GL2 plus GL4.
final boolean isGLES1()
Indicates whether this profile is capable of GLES1.
final boolean isGL4()
Indicates whether this profile is capable of GL4.
final boolean isGLES()
Indicates whether this profile is capable of GLES.
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
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 String GLES1
The embedded OpenGL profile ES 1.x, with x >= 0.
static final String GL4
The desktop OpenGL core profile 4.x, with x >= 0.
final boolean isGL3()
Indicates whether this profile is capable of GL3.
final boolean isGL2()
Indicates whether this profile is capable of GL2 .
GLRendererQuirks contains information of known bugs of various GL renderer.
final boolean exist(final int quirkBit)
Method tests whether the given quirk exists.
static final int NoFullFBOSupport
No full FBO support, i.e.
final StringBuilder toString(StringBuilder sb)
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.
Listener for GLDebugMessages.
An abstraction for an OpenGL rendering target.
void glGetIntegerv(int pname, IntBuffer data)
Entry point to C language function: void {@native glGetIntegerv}(GLenum pname, GLint * data) Part ...
static final int GL_NO_ERROR
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_NO_ERROR" with expres...
int glGetError()
Entry point to C language function: GLenum {@native glGetError}() Part of GL_ES_VERSION_2_0,...
static final int GL_MAX_SAMPLES
GL_ES_VERSION_3_0, GL_ARB_framebuffer_object, GL_VERSION_3_0, GL_NV_framebuffer_multisample,...