From b497b2cf2c6003186fc32b8c14bdcb07cc305787 Mon Sep 17 00:00:00 2001
From: Sven Gothel
* Can be turned off with property
@@ -228,10 +228,10 @@ public abstract class GLContext {
* @param quirk the quirk to be tested, e.g. {@link GLRendererQuirks#NoDoubleBufferedPBuffer}.
* @throws IllegalArgumentException if the quirk is out of range
*/
- public final boolean hasRendererQuirk(int quirk) throws IllegalArgumentException {
- return null != glRendererQuirks ? glRendererQuirks.exist(quirk) : false ;
+ public final boolean hasRendererQuirk(int quirk) throws IllegalArgumentException {
+ return null != glRendererQuirks ? glRendererQuirks.exist(quirk) : false ;
}
-
+
/**
* Sets the read/write drawable for framebuffer operations.
*
@@ -244,13 +244,13 @@ public abstract class GLContext {
* attempts to make this context current. Otherwise a race condition may happen.
*
* If the read-drawable has not been changed manually via {@link #setGLReadDrawable(GLDrawable)},
* it equals to the write-drawable (default).
- * true
(default), bootstrapping the available GL profiles
- * will use the highest compatible GL context for each profile,
+
+ /**
+ * If true
(default), bootstrapping the available GL profiles
+ * will use the highest compatible GL context for each profile,
* hence skipping querying lower profiles if a compatible higher one is found:
*
*
* Using aliasing speeds up initialization about:
*
- *
jogl.debug.GLContext.NoProfileAliasing
.
* ARB_create_context
related: created via ARB_create_context. Cache key value. See {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */
@@ -190,9 +190,9 @@ public abstract class GLContext {
private int currentSwapInterval;
protected GLRendererQuirks glRendererQuirks;
- /** Did the drawable association changed ? see {@link GLRendererQuirks#NoSetSwapIntervalPostRetarget} */
- protected boolean drawableRetargeted;
-
+ /** Did the drawable association changed ? see {@link GLRendererQuirks#NoSetSwapIntervalPostRetarget} */
+ protected boolean drawableRetargeted;
+
protected void resetStates() {
if (DEBUG) {
System.err.println(getThreadName() + ": GLContext.resetStates()");
@@ -210,12 +210,12 @@ public abstract class GLContext {
drawableRetargeted = false;
}
- /**
+ /**
* Returns the instance of {@link GLRendererQuirks}, allowing one to determine workarounds.
* @return instance of {@link GLRendererQuirks} if context was made current once, otherwise null
.
*/
public final GLRendererQuirks getRendererQuirks() { return glRendererQuirks; }
-
+
/**
* Returns true if the quirk
exist in {@link #getRendererQuirks()}, otherwise false.
* null
to remove association.
- * @param setWriteOnly Only change the write-drawable, if setWriteOnly
is true
and
- * if the {@link #getGLReadDrawable() read-drawable} differs
- * from the {@link #getGLDrawable() write-drawable}.
+ * @param setWriteOnly Only change the write-drawable, if setWriteOnly
is true
and
+ * if the {@link #getGLReadDrawable() read-drawable} differs
+ * from the {@link #getGLDrawable() write-drawable}.
* Otherwise set both drawables, read and write.
* @return The previous read/write drawable
*
- * @throws GLException in case null
is being passed or
+ * @throws GLException in case null
is being passed or
* this context is made current on another thread.
*
* @see #isGLReadDrawableAvailable()
@@ -259,13 +259,13 @@ public abstract class GLContext {
* @see #getGLDrawable()
*/
public abstract GLDrawable setGLDrawable(GLDrawable readWrite, boolean setWriteOnly);
-
+
/**
* Returns the write-drawable this context uses for framebuffer operations.
*
* If the read-drawable has not been changed manually via {@link #setGLReadDrawable(GLDrawable)}, * it equals to the write-drawable (default). - *
+ * * @see #isGLReadDrawableAvailable() * @see #setGLReadDrawable(javax.media.opengl.GLDrawable) * @see #getGLDrawable() @@ -321,9 +321,9 @@ public abstract class GLContext { * ** A return value of {@link #CONTEXT_CURRENT_NEW} - * indicates that that context has been made current for the 1st time, + * indicates that that context has been made current for the 1st time, * or that the state of the underlying context or drawable has - * changed since the last time this context was current. + * changed since the last time this context was current. * In this case, the application may wish to initialize the render state. *
*@@ -345,7 +345,7 @@ public abstract class GLContext { *
* * @returnGL_VERSION
not being the GL version.
*
- * In case no such version exists within GL_VERSION
,
+ * In case no such version exists within GL_VERSION
,
* the {@link VersionNumberString#zeroVersion zero version} instance is returned.
- *
* The vendor's version is usually the vendor's OpenGL driver version. *
@@ -702,31 +702,31 @@ public abstract class GLContext { * via {@link GL2ES2#GL_SHADING_LANGUAGE_VERSION} if ≥ ES2.0 or GL2.0, * otherwise a static match is being utilized. *- * The context must have been current once, - * otherwise the {@link VersionNumberString#zeroVersion zero version} instance is returned. + * The context must have been current once, + * otherwise the {@link VersionNumberString#zeroVersion zero version} instance is returned. *
*
- * Examples w/ major.minor
:
+ * Examples w/ major.minor
:
*
- * 1.00 (ES 2.0), 1.10 (GL 2.0), 1.20 (GL 2.1), 1.50 (GL 3.2), + * 1.00 (ES 2.0), 1.10 (GL 2.0), 1.20 (GL 2.1), 1.50 (GL 3.2), * 3.30 (GL 3.3), 4.00 (GL 4.0), 4.10 (GL 4.1), 4.20 (GL 4.2) ** *
* Matching could also refer to the maximum GLSL version usable by this context * since normal GL implementations are capable of using a lower GLSL version as well. - * The latter is not true on OSX w/ a GL3 context. + * The latter is not true on OSX w/ a GL3 context. *
- * - * @return GLSL version number if context has been made current at least once, + * + * @return GLSL version number if context has been made current at least once, * otherwise the {@link VersionNumberString#zeroVersion zero version} instance is returned. - * + * * @see #getGLVersionNumber() */ public final VersionNumber getGLSLVersionNumber() { return ctxGLSLVersion; } - + /** * Returns the GLSL version string as to be used in a shader program, including a terminating newline '\n', * i.e.: @@ -745,7 +745,7 @@ public abstract class GLContext { final int minor = ctxGLSLVersion.getMinor(); return "#version " + ctxGLSLVersion.getMajor() + ( minor < 10 ? "0"+minor : minor ) + "\n" ; } - + protected static final VersionNumber getStaticGLSLVersionNumber(int glMajorVersion, int glMinorVersion, int ctxOptions) { if( 0 != ( CTX_PROFILE_ES & ctxOptions ) ) { return Version100; // ES 2.0 -> GLSL 1.00 @@ -760,13 +760,13 @@ public abstract class GLContext { switch ( glMinorVersion ) { case 0: return Version130; // GL 3.0 -> GLSL 1.30 case 1: return Version140; // GL 3.1 -> GLSL 1.40 - default: return Version150; // GL 3.2 -> GLSL 1.50 + default: return Version150; // GL 3.2 -> GLSL 1.50 } } else { // >= 3.3 return new VersionNumber(glMajorVersion, glMinorVersion * 10, 0); // GL M.N -> GLSL M.N } } - + /** * @return true if this context is an ES2 context or implements * the extensionGL_ARB_ES2_compatibility
, otherwise false
@@ -775,18 +775,18 @@ public abstract class GLContext {
return 0 != ( ctxOptions & CTX_IMPL_ES2_COMPAT ) ;
}
- /**
+ /**
* @return true if impl. is a hardware rasterizer, otherwise false.
* @see #isHardwareRasterizer(AbstractGraphicsDevice, GLProfile)
- * @see GLProfile#isHardwareRasterizer()
+ * @see GLProfile#isHardwareRasterizer()
*/
public final boolean isHardwareRasterizer() {
return 0 == ( ctxOptions & CTX_IMPL_ACCEL_SOFT ) ;
}
-
+
/**
* @return true if context supports GLSL, i.e. is either {@link #isGLES2()}, {@link #isGL3()} or {@link #isGL2()} and major-version > 1.
- * @see GLProfile#hasGLSL()
+ * @see GLProfile#hasGLSL()
*/
public final boolean hasGLSL() {
return isGLES2() ||
@@ -794,7 +794,7 @@ public abstract class GLContext {
isGL2() && ctxVersion.getMajor()>1 ;
}
- /**
+ /**
* Returns true
if basic FBO support is available, otherwise false
.
*
* Basic FBO is supported if the context is either GL-ES >= 2.0, GL >= core 3.0 or implements the extensions
@@ -810,21 +810,21 @@ public abstract class GLContext {
return 0 != ( ctxOptions & CTX_IMPL_FBO ) ;
}
- /**
+ /**
* Returns true
if full FBO support is available, otherwise false
.
*
* Full FBO is supported if the context is either GL >= core 3.0 or implements the extensions
* ARB_framebuffer_object
, or all of
- * EXT_framebuffer_object
, EXT_framebuffer_multisample
,
+ * EXT_framebuffer_object
, EXT_framebuffer_multisample
,
* EXT_framebuffer_blit
, GL_EXT_packed_depth_stencil
.
*
* Full FBO support includes multiple color attachments and multisampling. *
*/ - public final boolean hasFullFBOSupport() { + public final boolean hasFullFBOSupport() { return hasBasicFBOSupport() && !hasRendererQuirk(GLRendererQuirks.NoFullFBOSupport) && - ( isGL3() || // GL >= 3.0 + ( isGL3() || // GL >= 3.0 isExtensionAvailable(GLExtensions.ARB_framebuffer_object) || // ARB_framebuffer_object ( isExtensionAvailable(GLExtensions.EXT_framebuffer_object) && // All EXT_framebuffer_object* isExtensionAvailable(GLExtensions.EXT_framebuffer_multisample) && @@ -833,10 +833,10 @@ public abstract class GLContext { ) ) ; } - + /** * Returns the maximum number of FBO RENDERBUFFER samples - * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false. + * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false. */ public final int getMaxRenderbufferSamples() { if( hasFullFBOSupport() ) { @@ -854,7 +854,7 @@ public abstract class GLContext { } return 0; } - + /** Note: The GL impl. may return a const value, ie {@link GLES2#isNPOTTextureAvailable()} always returnstrue
. */
public boolean isNPOTTextureAvailable() {
return isGL3() || isGLES2Compatible() || isExtensionAvailable(GLExtensions.ARB_texture_non_power_of_two);
@@ -883,7 +883,7 @@ public abstract class GLContext {
return ctxVersion.getMajor() >= 4 && 0 != (ctxOptions & CTX_IS_ARB_CREATED)
&& 0 != (ctxOptions & CTX_PROFILE_CORE);
}
-
+
/** @see GLProfile#isGL3bc() */
public final boolean isGL3bc() {
return ctxVersion.compareTo(Version31) >= 0
@@ -897,20 +897,20 @@ public abstract class GLContext {
&& 0 != (ctxOptions & CTX_IS_ARB_CREATED)
&& 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE));
}
-
+
/** Indicates whether this profile is capable of GL3 (core only). GL3 starts w/ OpenGL 3.1 Includes [ GL4, GL3 ].
*/ public final boolean isGL3core() { return ctxVersion.compareTo(Version31) >= 0 && 0 != (ctxOptions & CTX_IS_ARB_CREATED) && 0 != (ctxOptions & CTX_PROFILE_CORE); } - + /** @see GLProfile#isGL2() */ public final boolean isGL2() { return ctxVersion.getMajor()>=1 && 0!=(ctxOptions & CTX_PROFILE_COMPAT); } - /** @see GLProfile#isGL2GL3() */ + /** @see GLProfile#isGL2GL3() */ public final boolean isGL2GL3() { return isGL2() || isGL3(); } @@ -971,7 +971,7 @@ public abstract class GLContext { * *
* For a valid context the default value is 1
- * in case of an EGL based profile (ES1 or ES2) and -1
+ * in case of an EGL based profile (ES1 or ES2) and -1
* (undefined) for desktop.
*
+ *
* May differ from it's default zero
* in case an framebuffer object ({@link FBObject}) based drawable
* is being used.
- *
+ *
* May differ from it's default zero
* in case an framebuffer object ({@link FBObject}) based drawable
* is being used.
- *
* For offscreen framebuffer objects this is {@link GL#GL_COLOR_ATTACHMENT0}, - * otherwise this is {@link GL#GL_FRONT} for single buffer configurations + * otherwise this is {@link GL#GL_FRONT} for single buffer configurations * and {@link GL#GL_BACK} for double buffer configurations. - *
+ * */ public abstract int getDefaultReadBuffer(); - + /** Get the default pixel data type, as required by e.g. {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)}. */ public abstract int getDefaultPixelDataType(); - + /** Get the default pixel data format, as required by e.g. {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)}. */ public abstract int getDefaultPixelDataFormat(); - + /** * @return The extension implementing the GLDebugOutput feature, * either GL_ARB_debug_output or GL_AMD_debug_output. @@ -1314,7 +1314,7 @@ public abstract class GLContext { deviceVersionsAvailableSet.add(devKey); if (DEBUG) { System.err.println(getThreadName() + ": createContextARB: SET mappedVersionsAvailableSet "+devKey); - System.err.println(GLContext.dumpAvailableGLVersions(null).toString()); + System.err.println(GLContext.dumpAvailableGLVersions(null).toString()); } } } @@ -1398,7 +1398,7 @@ public abstract class GLContext { } return val; } - + /** * @param reqMajor Key Value either 1, 2, 3 or 4 * @param reqProfile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES} @@ -1470,7 +1470,7 @@ public abstract class GLContext { reqMajorCTP[1]=CTX_PROFILE_CORE; } } - + /** * @param device the device the context profile is being requested for * @param GLProfile the GLProfile the context profile is being requested for @@ -1479,7 +1479,7 @@ public abstract class GLContext { protected static final int getAvailableContextProperties(final AbstractGraphicsDevice device, final GLProfile glp) { final int[] reqMajorCTP = new int[] { 0, 0 }; getRequestMajorAndCompat(glp, reqMajorCTP); - + int _major[] = { 0 }; int _minor[] = { 0 }; int _ctp[] = { 0 }; @@ -1525,7 +1525,7 @@ public abstract class GLContext { * Returns true if it is possible to create an framebuffer object (FBO). ** FBO feature is implemented in OpenGL, hence it is {@link GLProfile} dependent. - *
+ * ** FBO support is queried as described in {@link #hasBasicFBOSupport()}. *
@@ -1537,16 +1537,16 @@ public abstract class GLContext { public static final boolean isFBOAvailable(AbstractGraphicsDevice device, GLProfile glp) { return 0 != ( CTX_IMPL_FBO & getAvailableContextProperties(device, glp) ); } - + /** - * @return1
if using a hardware rasterizer, 0
if using a software rasterizer and -1
if not determined yet.
+ * @return 1
if using a hardware rasterizer, 0
if using a software rasterizer and -1
if not determined yet.
* @see GLContext#isHardwareRasterizer()
- * @see GLProfile#isHardwareRasterizer()
+ * @see GLProfile#isHardwareRasterizer()
*/
public static final int isHardwareRasterizer(AbstractGraphicsDevice device, GLProfile glp) {
final int r;
final int ctp = getAvailableContextProperties(device, glp);
- if(0 == ctp) {
+ if(0 == ctp) {
r = -1;
} else if( 0 == ( CTX_IMPL_ACCEL_SOFT & ctp ) ) {
r = 1;
@@ -1555,7 +1555,7 @@ public abstract class GLContext {
}
return r;
}
-
+
/**
* @param device the device to request whether the profile is available for
* @param reqMajor Key Value either 1, 2, 3 or 4
@@ -1652,6 +1652,6 @@ public abstract class GLContext {
}
protected static String getThreadName() { return Thread.currentThread().getName(); }
-
+
}
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index a9e63d2f2..93472a6ba 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -102,14 +102,14 @@ public abstract class GLContextImpl extends GLContext {
private final GLStateTracker glStateTracker = new GLStateTracker();
private GLDebugMessageHandler glDebugHandler = null;
private final int[] boundFBOTarget = new int[] { 0, 0 }; // { draw, read }
- private int defaultVAO = 0;
-
+ private int defaultVAO = 0;
+
protected GLDrawableImpl drawable;
protected GLDrawableImpl drawableRead;
-
+
private volatile boolean pixelDataEvaluated;
private int /* pixelDataInternalFormat, */ pixelDataFormat, pixelDataType;
-
+
protected GL gl;
protected static final Object mappedContextTypeObjectLock;
@@ -173,12 +173,12 @@ public abstract class GLContextImpl extends GLContext {
glRenderer = glVendor;
glRendererLowerCase = glRenderer;
glVersion = glVendor;
-
+
if (boundFBOTarget != null) { // * If the GL query fails, major will be zero. - *
+ * ** Note: Non ARB ctx is limited to GL 3.0. *
@@ -1227,14 +1229,14 @@ public abstract class GLContextImpl extends GLContext { if(DEBUG) { Thread.dumpStack(); } - return false; + return false; } else { glGetIntegervInt(GL2GL3.GL_MAJOR_VERSION, glIntMajor, 0, _glGetIntegerv); glGetIntegervInt(GL2GL3.GL_MINOR_VERSION, glIntMinor, 0, _glGetIntegerv); return true; } } - + /** * Sets the OpenGL implementation class and * the cache of which GL functions are available for calling through this @@ -1254,8 +1256,8 @@ public abstract class GLContextImpl extends GLContext { *major.minor
version, andfalse
.
- * @return returns true
if successful, otherwise false
. See strictMatch
.
- * If false
is returned, no data has been cached or mapped, i.e. ProcAddressTable, Extensions, Version, etc.
+ * @return returns true
if successful, otherwise false
. See strictMatch
.
+ * If false
is returned, no data has been cached or mapped, i.e. ProcAddressTable, Extensions, Version, etc.
* @see #setContextVersion
* @see javax.media.opengl.GLContext#CTX_OPTION_ANY
* @see javax.media.opengl.GLContext#CTX_PROFILE_COMPAT
@@ -1266,10 +1268,10 @@ public abstract class GLContextImpl extends GLContext {
return true; // already done and not forced
}
- if ( 0 < major && !GLContext.isValidGLVersion(major, minor) ) {
+ if ( 0 < major && !GLContext.isValidGLVersion(ctxProfileBits, major, minor) ) {
throw new GLException("Invalid GL Version Request "+GLContext.getGLVersion(major, minor, ctxProfileBits, null));
}
-
+
if(null==this.gl || !verifyInstance(gl.getGLProfile(), "Impl", this.gl)) {
setGL( createGL( getGLDrawable().getGLProfile() ) );
}
@@ -1277,7 +1279,7 @@ public abstract class GLContextImpl extends GLContext {
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
-
+
{
final boolean initGLRendererAndGLVersionStringsOK = initGLRendererAndGLVersionStrings();
if( !initGLRendererAndGLVersionStringsOK ) {
@@ -1296,7 +1298,7 @@ public abstract class GLContextImpl extends GLContext {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Given "+adevice+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, glVersion));
}
}
-
+
//
// Validate GL version either by GL-Integer or GL-String
//
@@ -1306,8 +1308,8 @@ public abstract class GLContextImpl extends GLContext {
boolean versionValidated = false;
boolean versionGL3IntFailed = false;
{
- // Validate the requested version w/ the GL-version from an integer query.
- final int[] glIntMajor = new int[] { 0 }, glIntMinor = new int[] { 0 };
+ // Validate the requested version w/ the GL-version from an integer query.
+ final int[] glIntMajor = new int[] { 0 }, glIntMinor = new int[] { 0 };
final boolean getGLIntVersionOK = getGLIntVersion(glIntMajor, glIntMinor, ctxProfileBits);
if( !getGLIntVersionOK ) {
final String errMsg = "Fetching GL Integer Version failed. "+adevice+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, null);
@@ -1321,11 +1323,11 @@ public abstract class GLContextImpl extends GLContext {
// unusable GL context - non query mode - hard fail!
throw new GLException(errMsg);
}
- }
+ }
if (DEBUG) {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Version verification (Int): "+glVersion+", "+glIntMajor[0]+"."+glIntMinor[0]);
}
-
+
// Only validate if a valid int version was fetched, otherwise cont. w/ version-string method -> 3.0 > Version || Version > MAX!
if ( GLContext.isValidGLVersion(ctxProfileBits, glIntMajor[0], glIntMinor[0]) ) {
// relaxed match for versions major < 3 requests, last resort!
@@ -1350,7 +1352,7 @@ public abstract class GLContextImpl extends GLContext {
if (DEBUG) {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Version verification (String): "+glVersion+", "+hasGLVersionNumber);
}
-
+
// Only validate if a valid string version was fetched -> MIN > Version || Version > MAX!
if( null != hasGLVersionNumber ) {
// relaxed match for versions major < 3 requests, last resort!
@@ -1364,7 +1366,7 @@ public abstract class GLContextImpl extends GLContext {
if(DEBUG) {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL3 version Int failed, String: "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion+", "+hasGLVersionNumber);
}
- return false;
+ return false;
}
// Use returned GL version!
major = hasGLVersionNumber.getMajor();
@@ -1376,27 +1378,27 @@ public abstract class GLContextImpl extends GLContext {
if(DEBUG) {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, No GL version validation possible: "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion);
}
- return false;
+ return false;
}
if (DEBUG) {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Post version verification "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+", strictMatch "+strictMatch+", versionValidated "+versionValidated+", versionGL3IntFailed "+versionGL3IntFailed);
}
if( major < 2 ) { // there is no ES2/3-compat for a profile w/ major < 2
- ctxProfileBits &= ~ ( GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_ES3_COMPAT ) ;
+ ctxProfileBits &= ~ ( GLContext.CTX_IMPL_ES2_COMPAT /** | GLContext.CTX_IMPL_ES3_COMPAT (does not exist in this branch) */ ) ;
}
-
+
final VersionNumberString vendorVersion = GLVersionNumber.createVendorVersion(glVersion);
-
+
setRendererQuirks(adevice, major, minor, ctxProfileBits, vendorVersion);
-
+
if( strictMatch && glRendererQuirks.exist(GLRendererQuirks.GLNonCompliant) ) {
if(DEBUG) {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL is not compliant: "+GLContext.getGLVersion(major, minor, ctxProfileBits, glVersion)+", "+glRenderer);
}
return false;
}
-
+
if(!isCurrentContextHardwareRasterizer()) {
ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT;
}
@@ -1458,44 +1460,44 @@ public abstract class GLContextImpl extends GLContext {
}
}
}
-
+
if( ( 0 != ( CTX_PROFILE_ES & ctxProfileBits ) && major >= 2 ) || isExtensionAvailable(GLExtensions.ARB_ES2_compatibility) ) {
ctxProfileBits |= CTX_IMPL_ES2_COMPAT;
ctxProfileBits |= CTX_IMPL_FBO;
} else if( hasFBOImpl(major, ctxProfileBits, extensionAvailability) ) {
ctxProfileBits |= CTX_IMPL_FBO;
}
-
+
if(FORCE_NO_FBO_SUPPORT) {
ctxProfileBits &= ~CTX_IMPL_FBO ;
- }
-
+ }
+
//
// Set GL Version (complete w/ version string)
//
setContextVersion(major, minor, ctxProfileBits, vendorVersion, true);
-
+
setDefaultSwapInterval();
-
+
final int glErrX = gl.glGetError(); // clear GL error, maybe caused by above operations
-
+
if(DEBUG) {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: OK "+contextFQN+" - "+GLContext.getGLVersion(ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions, null)+" - glErr "+toHexString(glErrX));
}
return true;
}
-
+
private final void setRendererQuirks(final AbstractGraphicsDevice adevice, int major, int minor, int ctp, final VersionNumberString vendorVersion) {
int[] quirks = new int[GLRendererQuirks.COUNT + 1]; // + 1 ( NoFullFBOSupport )
int i = 0;
-
+
final String MesaSP = "Mesa ";
final boolean hwAccel = 0 == ( ctp & GLContext.CTX_IMPL_ACCEL_SOFT );
final boolean compatCtx = 0 != ( ctp & GLContext.CTX_PROFILE_COMPAT );
final boolean isDriverMesa = glRenderer.contains(MesaSP) || glRenderer.contains("Gallium ");
final boolean isDriverATICatalyst = !isDriverMesa && ( glVendor.contains("ATI Technologies") || glRenderer.startsWith("ATI ") );
final boolean isDriverNVIDIAGeForce = !isDriverMesa && ( glVendor.contains("NVIDIA Corporation") || glRenderer.contains("NVIDIA ") );
-
+
//
// OS related quirks
//
@@ -1510,7 +1512,7 @@ public abstract class GLContextImpl extends GLContext {
}
quirks[i++] = quirk;
}
-
+
final VersionNumber OSXVersion173 = new VersionNumber(1,7,3);
if( Platform.getOSVersionNumber().compareTo(OSXVersion173) < 0 && isDriverNVIDIAGeForce ) {
final int quirk = GLRendererQuirks.GLFlushBeforeRelease;
@@ -1519,7 +1521,7 @@ public abstract class GLContextImpl extends GLContext {
}
quirks[i++] = quirk;
}
- } else if( Platform.getOSType() == Platform.OSType.WINDOWS ) {
+ } else if( Platform.getOSType() == Platform.OSType.WINDOWS ) {
//
// WINDOWS
//
@@ -1530,28 +1532,28 @@ public abstract class GLContextImpl extends GLContext {
}
quirks[i++] = quirk;
}
-
+
if( isDriverATICatalyst ) {
- final VersionNumber winXPVersionNumber = new VersionNumber ( 5, 1, 0);
- final VersionNumber amdSafeMobilityVersion = new VersionNumber(12, 102, 3);
-
+ final VersionNumber winXPVersionNumber = new VersionNumber ( 5, 1, 0);
+ final VersionNumber amdSafeMobilityVersion = new VersionNumber(12, 102, 3);
+
if ( vendorVersion.compareTo(amdSafeMobilityVersion) < 0 ) { // includes: vendorVersion.isZero()
final int quirk = GLRendererQuirks.NeedCurrCtx4ARBCreateContext;
if(DEBUG) {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", [Vendor "+glVendor+" or Renderer "+glRenderer+"], driverVersion "+vendorVersion);
}
- quirks[i++] = quirk;
+ quirks[i++] = quirk;
}
-
+
if( Platform.getOSVersionNumber().compareTo(winXPVersionNumber) <= 0 ) {
final int quirk = GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries;
if(DEBUG) {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS-Version "+Platform.getOSType()+" "+Platform.getOSVersionNumber()+", [Vendor "+glVendor+" or Renderer "+glRenderer+"]");
}
- quirks[i++] = quirk;
+ quirks[i++] = quirk;
}
}
- } else if( Platform.OSType.ANDROID == Platform.getOSType() ) {
+ } else if( Platform.OSType.ANDROID == Platform.getOSType() ) {
//
// ANDROID
//
@@ -1564,7 +1566,7 @@ public abstract class GLContextImpl extends GLContext {
quirks[i++] = quirk;
}
}
-
+
//
// Windowing Toolkit related quirks
//
@@ -1601,8 +1603,8 @@ public abstract class GLContextImpl extends GLContext {
}
}
}
-
-
+
+
//
// RENDERER related quirks
//
@@ -1633,8 +1635,8 @@ public abstract class GLContextImpl extends GLContext {
}
if( Platform.getOSType() == Platform.OSType.WINDOWS && glRenderer.contains("SVGA3D") )
{
- final VersionNumber mesaSafeFBOVersion = new VersionNumber(8, 0, 0);
- if ( vendorVersion.compareTo(mesaSafeFBOVersion) < 0 ) { // includes: vendorVersion.isZero()
+ final VersionNumber mesaSafeFBOVersion = new VersionNumber(8, 0, 0);
+ if ( vendorVersion.compareTo(mesaSafeFBOVersion) < 0 ) { // includes: vendorVersion.isZero()
final int quirk = GLRendererQuirks.NoFullFBOSupport;
if(DEBUG) {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType() + " / Renderer " + glRenderer + " / Mesa-Version "+vendorVersion);
@@ -1643,7 +1645,7 @@ public abstract class GLContextImpl extends GLContext {
}
}
}
-
+
//
// Property related quirks
//
@@ -1652,28 +1654,28 @@ public abstract class GLContextImpl extends GLContext {
if(DEBUG) {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: property");
}
- quirks[i++] = quirk;
+ quirks[i++] = quirk;
}
-
+
glRendererQuirks = new GLRendererQuirks(quirks, 0, i);
}
-
+
private static final boolean hasFBOImpl(int major, int ctp, ExtensionAvailabilityCache extCache) {
return ( 0 != (ctp & CTX_PROFILE_ES) && major >= 2 ) || // ES >= 2.0
-
- major >= 3 || // any >= 3.0 GL ctx
-
+
+ major >= 3 || // any >= 3.0 GL ctx
+
( null != extCache &&
-
+
extCache.isExtensionAvailable(GLExtensions.ARB_ES2_compatibility) || // ES 2.0 compatible
-
+
extCache.isExtensionAvailable(GLExtensions.ARB_framebuffer_object) || // ARB_framebuffer_object
-
+
extCache.isExtensionAvailable(GLExtensions.EXT_framebuffer_object) || // EXT_framebuffer_object
-
- extCache.isExtensionAvailable(GLExtensions.OES_framebuffer_object) ) ; // OES_framebuffer_object excluded
+
+ extCache.isExtensionAvailable(GLExtensions.OES_framebuffer_object) ) ; // OES_framebuffer_object excluded
}
-
+
private final void removeCachedVersion(int major, int minor, int ctxProfileBits) {
if(!isCurrentContextHardwareRasterizer()) {
ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT;
@@ -1833,7 +1835,7 @@ public abstract class GLContextImpl extends GLContext {
evalPixelDataType();
return pixelDataFormat;
}
-
+
private final void evalPixelDataType() {
if(!pixelDataEvaluated) {
synchronized(this) {
@@ -1841,20 +1843,20 @@ public abstract class GLContextImpl extends GLContext {
/* if(isGL2GL3() && 3 == components) {
pixelDataInternalFormat=GL.GL_RGB;
pixelDataFormat=GL.GL_RGB;
- pixelDataType = GL.GL_UNSIGNED_BYTE;
+ pixelDataType = GL.GL_UNSIGNED_BYTE;
} else */ if(isGLES2Compatible() || isExtensionAvailable(GLExtensions.OES_read_format)) {
final int[] glImplColorReadVals = new int[] { 0, 0 };
gl.glGetIntegerv(GL.GL_IMPLEMENTATION_COLOR_READ_FORMAT, glImplColorReadVals, 0);
- gl.glGetIntegerv(GL.GL_IMPLEMENTATION_COLOR_READ_TYPE, glImplColorReadVals, 1);
+ gl.glGetIntegerv(GL.GL_IMPLEMENTATION_COLOR_READ_TYPE, glImplColorReadVals, 1);
// pixelDataInternalFormat = (4 == components) ? GL.GL_RGBA : GL.GL_RGB;
pixelDataFormat = glImplColorReadVals[0];
pixelDataType = glImplColorReadVals[1];
} else {
- // RGBA read is safe for all GL profiles
+ // RGBA read is safe for all GL profiles
// pixelDataInternalFormat = (4 == components) ? GL.GL_RGBA : GL.GL_RGB;
pixelDataFormat=GL.GL_RGBA;
pixelDataType = GL.GL_UNSIGNED_BYTE;
- }
+ }
// TODO: Consider:
// return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1;
pixelDataEvaluated = true;
@@ -1881,7 +1883,7 @@ public abstract class GLContextImpl extends GLContext {
public final GLStateTracker getGLStateTracker() {
return glStateTracker;
}
-
+
public final boolean isDefaultVAO(int vao) {
return defaultVAO == vao;
}
@@ -1891,48 +1893,48 @@ public abstract class GLContextImpl extends GLContext {
// current on the OpenGL worker thread
//
- /**
+ /**
* Returns true if the given thread is owner, otherwise false.
* * Method exists merely for code validation of {@link #isCurrent()}. - *
+ * */ public final boolean isOwner(Thread thread) { return lock.isOwner(thread); } - - /** + + /** * Returns true if there are other threads waiting for this GLContext to {@link #makeCurrent()}, otherwise false. ** Since method does not perform any synchronization, accurate result are returned if lock is hold - only. - *
+ * */ public final boolean hasWaiters() { return lock.getQueueLength()>0; } - - /** + + /** * Returns the number of hold locks. See {@link RecursiveLock#getHoldCount()} for semantics. ** Since method does not perform any synchronization, accurate result are returned if lock is hold - only. - *
+ * */ public final int getLockCount() { return lock.getHoldCount(); } - + //--------------------------------------------------------------------------- // Special FBO hook // - + /** * Tracks {@link GL#GL_FRAMEBUFFER}, {@link GL2GL3#GL_DRAW_FRAMEBUFFER} and {@link GL2GL3#GL_READ_FRAMEBUFFER} * to be returned via {@link #getBoundFramebuffer(int)}. - * + * *Invoked by {@link GL#glBindFramebuffer(int, int)}.
- * - *Assumes valid framebufferName
range of [0..{@link Integer#MAX_VALUE}]
Assumes valid framebufferName
range of [0..{@link Integer#MAX_VALUE}]
Does not throw an exception if target
is unknown or framebufferName
invalid.