summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-06-27 05:40:32 +0200
committerSven Gothel <[email protected]>2012-06-27 05:40:32 +0200
commit4e2fb5389d22f2b16c1678843d4e31dd948c7902 (patch)
tree49df6dd262394b452877e9ec6a39e8a3a286b0bf /src/jogl
parent1d9ce79f9e396599b2503f385c74bd132bf88fed (diff)
Misc cleanup: Add @Override, remove trailing whitespace
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java217
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java265
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLContext.java47
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java21
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLOnscreenContext.java19
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLPbufferContext.java20
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java165
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java22
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java28
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java21
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLContext.java19
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLContext.java20
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLContext.java20
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java71
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java62
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXContext.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXContext.java17
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXContext.java19
18 files changed, 603 insertions, 464 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index e23fa74f9..19501e589 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -66,14 +66,14 @@ import jogamp.opengl.GLContextImpl;
abstraction provides a stable object which clients can use to
refer to a given context. */
public abstract class GLContext {
- public static final boolean DEBUG = Debug.debug("GLContext");
+ public static final boolean DEBUG = Debug.debug("GLContext");
public static final boolean TRACE_SWITCH = Debug.isPropertyDefined("jogl.debug.GLContext.TraceSwitch", true);
-
+
/** Reflects property jogl.debug.DebugGL. If true, the debug pipeline is enabled at context creation. */
public final static boolean DEBUG_GL = Debug.isPropertyDefined("jogl.debug.DebugGL", true);
/** Reflects property jogl.debug.TraceGL. If true, the trace pipeline is enabled at context creation. */
public final static boolean TRACE_GL = Debug.isPropertyDefined("jogl.debug.TraceGL", true);
-
+
/** Indicates that the context was not made current during the last call to {@link #makeCurrent makeCurrent}. */
public static final int CONTEXT_NOT_CURRENT = 0;
/** Indicates that the context was made current during the last call to {@link #makeCurrent makeCurrent}. */
@@ -93,19 +93,19 @@ public abstract class GLContext {
protected static final int CTX_OPTION_FORWARD = 1 << 4;
/** <code>ARB_create_context</code> related: flag debug. Not a cache key. */
public static final int CTX_OPTION_DEBUG = 1 << 5;
-
+
/** <code>GL_ARB_ES2_compatibility</code> implementation related: Context is compatible w/ ES2. Not a cache key. */
protected static final int CTX_IMPL_ES2_COMPAT = 1 << 8;
/** Context uses software rasterizer, otherwise hardware rasterizer. Cache key value. */
protected static final int CTX_IMPL_ACCEL_SOFT = 1 << 15;
-
+
private static ThreadLocal<GLContext> currentContext = new ThreadLocal<GLContext>();
private HashMap<String, Object> attachedObjectsByString = new HashMap<String, Object>();
private IntObjectHashMap attachedObjectsByInt = new IntObjectHashMap();
- // RecursiveLock maintains a queue of waiting Threads, ensuring the longest waiting thread will be notified at unlock.
+ // RecursiveLock maintains a queue of waiting Threads, ensuring the longest waiting thread will be notified at unlock.
protected RecursiveLock lock = LockFactory.createRecursiveLock();
/** The underlying native OpenGL context */
@@ -114,7 +114,7 @@ public abstract class GLContext {
protected GLContext() {
resetStates();
}
-
+
protected int ctxMajorVersion;
protected int ctxMinorVersion;
protected int ctxOptions;
@@ -188,7 +188,7 @@ public abstract class GLContext {
* the underlying drawable has not ben realized on the display) ,
* a value of CONTEXT_NOT_CURRENT is returned.
* </p>
- * <p>
+ * <p>
* If the context is in use by another thread at the time of the
* call, then if isSynchronized() is true the call will
* block. If isSynchronized() is false, an exception will be
@@ -196,7 +196,7 @@ public abstract class GLContext {
* </p>
* <p>
* The drawable's surface is being locked at entry
- * and unlocked at {@link #release()}
+ * and unlocked at {@link #release()}
* </p>
*
* @return CONTEXT_CURRENT if the context was successfully made current
@@ -216,7 +216,7 @@ public abstract class GLContext {
* Releases control of this GLContext from the current thread.
* <p>
* The drawable's surface is being unlocked at exit,
- * assumed to be locked by {@link #makeCurrent()}.
+ * assumed to be locked by {@link #makeCurrent()}.
* </p>
*
* @throws GLException if the context had not previously been made
@@ -284,18 +284,18 @@ public abstract class GLContext {
* @return true if this GLContext is current on this thread
*/
public final boolean isCurrent() {
- return getCurrent() == this ;
+ return getCurrent() == this ;
}
/**
* @throws GLException if this GLContext is not current on this thread
*/
- public final void validateCurrent() throws GLException {
+ public final void validateCurrent() throws GLException {
if(getCurrent() != this) {
throw new GLException(getThreadName()+": This context is not current. Current context: "+getCurrent()+", this context "+this);
}
}
-
+
/**
* Sets the thread-local variable returned by {@link #getCurrent}
* and has no other side-effects. For use by third parties adding
@@ -307,14 +307,14 @@ public abstract class GLContext {
}
currentContext.set(cur);
}
-
+
/**
* Destroys this OpenGL context and frees its associated
* resources.
* <p>
* The context may be current w/o recursion when calling <code>destroy()</code>,
* in which case this method destroys the context and releases the lock.
- * </p>
+ * </p>
*/
public abstract void destroy();
@@ -337,8 +337,8 @@ public abstract class GLContext {
*/
public final long getHandle() { return contextHandle; }
- /**
- * Indicates whether the underlying OpenGL context has been created.
+ /**
+ * Indicates whether the underlying OpenGL context has been created.
*/
public final boolean isCreated() {
return 0 != contextHandle;
@@ -369,7 +369,7 @@ public abstract class GLContext {
public final Object detachObject(int name) {
return attachedObjectsByInt.remove(name);
}
-
+
/**
* Sets the attached user object for the given name to this GLContext.
* Returns the previously set object or null.
@@ -381,10 +381,11 @@ public abstract class GLContext {
public final Object detachObject(String name) {
return attachedObjectsByString.remove(name);
}
-
+
/**
* Classname, GL, GLDrawable
*/
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
@@ -433,7 +434,7 @@ public abstract class GLContext {
* javax.media.opengl.GL#glPolygonOffset(float,float)} is available).
*/
public abstract boolean isFunctionAvailable(String glFunctionName);
-
+
/**
* Returns true if the specified OpenGL extension can be
* successfully called using this GL context given the current host (OpenGL
@@ -445,10 +446,10 @@ public abstract class GLContext {
* "GL_VERTEX_PROGRAM_ARB").
*/
public abstract boolean isExtensionAvailable(String glExtensionName);
-
+
/** Returns the number of platform extensions */
public abstract int getPlatformExtensionCount();
-
+
/** Returns a non-null (but possibly empty) string containing the
space-separated list of available platform-dependent (e.g., WGL,
GLX) extensions. Can only be called while this context is
@@ -457,7 +458,7 @@ public abstract class GLContext {
/** Returns the number of OpenGL extensions */
public abstract int getGLExtensionCount();
-
+
/** Returns a non-null (but possibly empty) string containing the
space-separated list of available extensions.
Can only be called while this context is current.
@@ -479,8 +480,8 @@ public abstract class GLContext {
* @see GLAutoDrawable#setContextCreationFlags(int)
*/
public abstract void setContextCreationFlags(int flags);
-
- /**
+
+ /**
* Returns a valid OpenGL version string, ie<br>
* <pre>
* major.minor ([option]?[options,]*) - gl-version
@@ -509,7 +510,7 @@ public abstract class GLContext {
* <td>row 2, cell 1</td>
* <td>row 2, cell 2</td>
* </tr>
- * </table>
+ * </table>
*
* <table border="0">
* <tr><td></td> <td>ES2</td> <td><code>2.0 (ES profile, ES2 compatible, hardware) - 2.0 ES Profile</code></td></tr>
@@ -520,7 +521,7 @@ public abstract class GLContext {
* <tr><td>NV</td><td>GL3</td> <td><code>3.3 (Core profile, arb, hardware) - 3.3.0 NVIDIA 195.36.07.03</code></td></tr>
* <tr><td>NV</td><td>GL3bc</td> <td><code>3.3 (Compatibility profile, arb, hardware) - 3.3.0 NVIDIA 195.36.07.03</code></td></tr>
* <tr><td>NV</td><td>GL2</td> <td><code>3.0 (Compatibility profile, arb, ES2 compatible, hardware) - 3.0.0 NVIDIA 290.10</code></td></tr>
- * </table>
+ * </table>
*/
public final String getGLVersion() {
return ctxVersionString;
@@ -533,28 +534,28 @@ public abstract class GLContext {
public final boolean isGLForwardCompatible() { return ( 0 != ( CTX_OPTION_FORWARD & ctxOptions ) ); }
public final boolean isGLDebugEnabled() { return ( 0 != ( CTX_OPTION_DEBUG & ctxOptions ) ); }
public final boolean isCreatedWithARBMethod() { return ( 0 != ( CTX_IS_ARB_CREATED & ctxOptions ) ); }
-
+
/**
- * @return true if this context is an ES2 context or implements
- * the extension <code>GL_ARB_ES2_compatibility</code>, otherwise false
+ * @return true if this context is an ES2 context or implements
+ * the extension <code>GL_ARB_ES2_compatibility</code>, otherwise false
*/
public final boolean isGLES2Compatible() {
return 0 != ( ctxOptions & CTX_IMPL_ES2_COMPAT ) ;
}
-
+
public final boolean hasGLSL() {
return isGL2ES2() ;
}
-
+
/** Note: The GL impl. may return a const value, ie {@link GLES2#isNPOTTextureAvailable()} always returns <code>true</code>. */
public boolean isNPOTTextureAvailable() {
return isGL3() || isGLES2Compatible() || isExtensionAvailable(GL_ARB_texture_non_power_of_two);
}
private static final String GL_ARB_texture_non_power_of_two = "GL_ARB_texture_non_power_of_two";
-
+
public boolean isTextureFormatBGRA8888Available() {
- return isGL2GL3() ||
- isExtensionAvailable("GL_EXT_texture_format_BGRA8888") ||
+ return isGL2GL3() ||
+ isExtensionAvailable("GL_EXT_texture_format_BGRA8888") ||
isExtensionAvailable("GL_IMG_texture_format_BGRA8888") ;
}
@@ -610,11 +611,11 @@ public abstract class GLContext {
/**
* Set the swap interval if the current context.
- * @param interval Should be &ge; 0. 0 Disables the vertical synchronisation,
+ * @param interval Should be &ge; 0. 0 Disables the vertical synchronisation,
* where &ge; 1 is the number of vertical refreshes before a swap buffer occurs.
* A value &lt; 0 is ignored.
- * @return true if the operation was successful, otherwise false
- *
+ * @return true if the operation was successful, otherwise false
+ *
* @throws GLException if the context is not current.
*/
public final boolean setSwapInterval(int interval) throws GLException {
@@ -627,16 +628,16 @@ public abstract class GLContext {
}
return false;
}
- protected boolean setSwapIntervalImpl(int interval) {
- return false;
- }
- /** Return the current swap interval.
+ protected boolean setSwapIntervalImpl(int interval) {
+ return false;
+ }
+ /** Return the current swap interval.
* <p>
* If the context has not been made current at all,
* the default value <code>-1</code> is returned.
* </p>
* <p>
- * The default value for a valid context is <code>1</code> for
+ * The default value for a valid context is <code>1</code> for
* an EGL based profile (ES1 or ES2) and <code>-1</code> (undefined)
* for desktop.
* </p>
@@ -652,9 +653,9 @@ public abstract class GLContext {
currentSwapInterval = 1;
} else {
currentSwapInterval = -1;
- }
+ }
}
-
+
public final boolean queryMaxSwapGroups(int[] maxGroups, int maxGroups_offset,
int[] maxBarriers, int maxBarriers_offset) {
validateCurrent();
@@ -667,21 +668,21 @@ public abstract class GLContext {
return joinSwapGroupImpl(group);
}
protected boolean joinSwapGroupImpl(int group) { /** nop per default .. **/ return false; }
- protected int currentSwapGroup = -1; // default: not set yet ..
+ protected int currentSwapGroup = -1; // default: not set yet ..
public int getSwapGroup() {
return currentSwapGroup;
}
public final boolean bindSwapBarrier(int group, int barrier) {
validateCurrent();
- return bindSwapBarrierImpl(group, barrier);
+ return bindSwapBarrierImpl(group, barrier);
}
protected boolean bindSwapBarrierImpl(int group, int barrier) { /** nop per default .. **/ return false; }
-
+
/**
- * @return The extension implementing the GLDebugOutput feature,
- * either <i>GL_ARB_debug_output</i> or <i>GL_AMD_debug_output</i>.
- * If unavailable or called before initialized via {@link #makeCurrent()}, <i>null</i> is returned.
+ * @return The extension implementing the GLDebugOutput feature,
+ * either <i>GL_ARB_debug_output</i> or <i>GL_AMD_debug_output</i>.
+ * If unavailable or called before initialized via {@link #makeCurrent()}, <i>null</i> is returned.
*/
public abstract String getGLDebugMessageExtension();
@@ -690,84 +691,84 @@ public abstract class GLContext {
* @see #setSynchronous(boolean)
*/
public abstract boolean isGLDebugSynchronous();
-
+
/**
* Enables or disables the synchronous debug behavior via
- * {@link GL2GL3#GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB glEnable/glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB)},
+ * {@link GL2GL3#GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB glEnable/glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB)},
* if extension is {@link #GL_ARB_debug_output}.
* There is no equivalent for {@link #GL_AMD_debug_output}.
- * <p> The default is <code>true</code>, ie {@link GL2GL3#GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB}.</p>
+ * <p> The default is <code>true</code>, ie {@link GL2GL3#GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB}.</p>
*/
public abstract void setGLDebugSynchronous(boolean synchronous);
-
+
/**
* @return true if the GLDebugOutput feature is enabled or not.
*/
public abstract boolean isGLDebugMessageEnabled();
-
+
/**
- * Enables or disables the GLDebugOutput feature of extension <i>GL_ARB_debug_output</i>
+ * Enables or disables the GLDebugOutput feature of extension <i>GL_ARB_debug_output</i>
* or <i>GL_AMD_debug_output</i>, if available.
- *
+ *
* <p>To enable the GLDebugOutput feature {@link #enableGLDebugMessage(boolean) enableGLDebugMessage(true)}
* or {@link #setContextCreationFlags(int) setContextCreationFlags}({@link GLContext#CTX_OPTION_DEBUG})
* shall be called <b>before</b> context creation via {@link #makeCurrent()}!</p>
- *
- * <p>In case {@link GLAutoDrawable} are being used,
+ *
+ * <p>In case {@link GLAutoDrawable} are being used,
* {@link GLAutoDrawable#setContextCreationFlags(int) glAutoDrawable.setContextCreationFlags}({@link GLContext#CTX_OPTION_DEBUG})
* shall be issued before context creation via {@link #makeCurrent()}!</p>
- *
+ *
* <p>After context creation, the GLDebugOutput feature may be enabled or disabled at any time using this method.</p>
- *
+ *
* @param enable If true enables, otherwise disables the GLDebugOutput feature.
- *
+ *
* @throws GLException if this context is not current or GLDebugOutput registration failed (enable)
- *
+ *
* @see #setContextCreationFlags(int)
* @see #addGLDebugListener(GLDebugListener)
* @see GLAutoDrawable#setContextCreationFlags(int)
*/
public abstract void enableGLDebugMessage(boolean enable) throws GLException;
-
+
/**
* Add {@link GLDebugListener}.<br>
- *
+ *
* @param listener {@link GLDebugListener} handling {@GLDebugMessage}s
- * @see #enableGLDebugMessage(boolean)
+ * @see #enableGLDebugMessage(boolean)
* @see #removeGLDebugListener(GLDebugListener)
*/
public abstract void addGLDebugListener(GLDebugListener listener);
-
+
/**
* Remove {@link GLDebugListener}.<br>
- *
+ *
* @param listener {@link GLDebugListener} handling {@GLDebugMessage}s
- * @see #enableGLDebugMessage(boolean)
+ * @see #enableGLDebugMessage(boolean)
* @see #addGLDebugListener(GLDebugListener)
*/
public abstract void removeGLDebugListener(GLDebugListener listener);
-
+
/**
- * Generic entry for {@link GL2GL3#glDebugMessageControlARB(int, int, int, int, IntBuffer, boolean)}
+ * Generic entry for {@link GL2GL3#glDebugMessageControlARB(int, int, int, int, IntBuffer, boolean)}
* and {@link GL2GL3#glDebugMessageEnableAMD(int, int, int, IntBuffer, boolean)} of the GLDebugOutput feature.
- * @see #enableGLDebugMessage(boolean)
+ * @see #enableGLDebugMessage(boolean)
*/
public abstract void glDebugMessageControl(int source, int type, int severity, int count, IntBuffer ids, boolean enabled);
-
+
/**
- * Generic entry for {@link GL2GL3#glDebugMessageControlARB(int, int, int, int, int[], int, boolean)}
- * and {@link GL2GL3#glDebugMessageEnableAMD(int, int, int, int[], int, boolean)} of the GLDebugOutput feature.
- * @see #enableGLDebugMessage(boolean)
+ * Generic entry for {@link GL2GL3#glDebugMessageControlARB(int, int, int, int, int[], int, boolean)}
+ * and {@link GL2GL3#glDebugMessageEnableAMD(int, int, int, int[], int, boolean)} of the GLDebugOutput feature.
+ * @see #enableGLDebugMessage(boolean)
*/
public abstract void glDebugMessageControl(int source, int type, int severity, int count, int[] ids, int ids_offset, boolean enabled);
-
+
/**
- * Generic entry for {@link GL2GL3#glDebugMessageInsertARB(int, int, int, int, int, String)}
+ * Generic entry for {@link GL2GL3#glDebugMessageInsertARB(int, int, int, int, int, String)}
* and {@link GL2GL3#glDebugMessageInsertAMD(int, int, int, int, String)} of the GLDebugOutput feature.
- * @see #enableGLDebugMessage(boolean)
+ * @see #enableGLDebugMessage(boolean)
*/
public abstract void glDebugMessageInsert(int source, int type, int id, int severity, String buf);
-
+
public static final int GL_VERSIONS[][] = {
/* 0.*/ { -1 },
/* 1.*/ { 0, 1, 2, 3, 4, 5 },
@@ -832,7 +833,7 @@ public abstract class GLContext {
//
/**
- * @see #getDeviceVersionAvailableKey(javax.media.nativewindow.AbstractGraphicsDevice, int, int)
+ * @see #getDeviceVersionAvailableKey(javax.media.nativewindow.AbstractGraphicsDevice, int, int)
*/
protected static /*final*/ HashMap<String, Integer> deviceVersionAvailable = new HashMap<String, Integer>();
@@ -863,11 +864,11 @@ public abstract class GLContext {
}
}
}
-
+
/** clears the device/context mappings as well as the GL/GLX proc address tables. */
protected static void shutdown() {
deviceVersionAvailable.clear();
- deviceVersionsAvailableSet.clear();
+ deviceVersionsAvailableSet.clear();
GLContextImpl.shutdownImpl(); // well ..
}
@@ -919,7 +920,7 @@ public abstract class GLContext {
* @param minor if not null, returns the used minor version
* @param ctp if not null, returns the used context profile
*/
- protected static boolean getAvailableGLVersion(AbstractGraphicsDevice device, int reqMajor, int reqProfile,
+ protected static boolean getAvailableGLVersion(AbstractGraphicsDevice device, int reqMajor, int reqProfile,
int[] major, int minor[], int ctp[]) {
Integer valI = getAvailableGLVersion(device, reqMajor, reqProfile);
@@ -940,34 +941,34 @@ public abstract class GLContext {
}
return true;
}
-
- /**
+
+ /**
* returns the highest GLProfile string regarding the implementation version and context profile bits.
* @throws GLException if version and context profile bits could not be mapped to a GLProfile
*/
- protected static String getGLProfile(int major, int minor, int ctp)
+ protected static String getGLProfile(int major, int minor, int ctp)
throws GLException {
- if(0 != ( CTX_PROFILE_COMPAT & ctp )) {
+ if(0 != ( CTX_PROFILE_COMPAT & ctp )) {
if(major >= 4) { return GLProfile.GL4bc; }
else if(major == 3 && minor >= 1) { return GLProfile.GL3bc; }
- else { return GLProfile.GL2; }
+ else { return GLProfile.GL2; }
} else if(0 != ( CTX_PROFILE_CORE & ctp )) {
if(major >= 4) { return GLProfile.GL4; }
- else if(major == 3 && minor >= 1) { return GLProfile.GL3; }
+ else if(major == 3 && minor >= 1) { return GLProfile.GL3; }
} else if(0 != ( CTX_PROFILE_ES & ctp )) {
if(major == 2) { return GLProfile.GLES2; }
- else if(major == 1) { return GLProfile.GLES1; }
+ else if(major == 1) { return GLProfile.GLES1; }
}
throw new GLException("Unhandled OpenGL version/profile: "+GLContext.getGLVersion(major, minor, ctp, null));
}
-
- /**
+
+ /**
* @param major Key Value either 1, 2, 3 or 4
* @param profile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES}
* @return the highest GLProfile string regarding the version and profile bits.
* @throws GLException if version and context profile bits could not be mapped to a GLProfile
- */
- public static String getAvailableGLProfile(AbstractGraphicsDevice device, int reqMajor, int reqProfile)
+ */
+ public static String getAvailableGLProfile(AbstractGraphicsDevice device, int reqMajor, int reqProfile)
throws GLException {
int major[] = { 0 };
int minor[] = { 0 };
@@ -1046,9 +1047,9 @@ public abstract class GLContext {
needColon = appendString(sb, "ES profile", needColon, 0 != ( CTX_PROFILE_ES & ctp ));
needColon = appendString(sb, "Compatibility profile", needColon, 0 != ( CTX_PROFILE_COMPAT & ctp ));
needColon = appendString(sb, "Core profile", needColon, 0 != ( CTX_PROFILE_CORE & ctp ));
- needColon = appendString(sb, "forward", needColon, 0 != ( CTX_OPTION_FORWARD & ctp ));
+ needColon = appendString(sb, "forward", needColon, 0 != ( CTX_OPTION_FORWARD & ctp ));
needColon = appendString(sb, "arb", needColon, 0 != ( CTX_IS_ARB_CREATED & ctp ));
- needColon = appendString(sb, "debug", needColon, 0 != ( CTX_OPTION_DEBUG & ctp ));
+ needColon = appendString(sb, "debug", needColon, 0 != ( CTX_OPTION_DEBUG & ctp ));
needColon = appendString(sb, "ES2 compatible", needColon, 0 != ( CTX_IMPL_ES2_COMPAT & ctp ));
if( 0 != ( CTX_IMPL_ACCEL_SOFT & ctp ) ) {
needColon = appendString(sb, "software", needColon, true);
@@ -1064,9 +1065,9 @@ public abstract class GLContext {
}
//
- // internal string utils
+ // internal string utils
//
-
+
protected static String toHexString(int hex) {
return "0x" + Integer.toHexString(hex);
}
@@ -1085,7 +1086,7 @@ public abstract class GLContext {
}
return needColon;
}
-
+
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 ff1b65520..8c1b56dbd 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -56,7 +56,7 @@ import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeSurface;
import javax.media.opengl.GL;
-import javax.media.opengl.GL3;
+import javax.media.opengl.GL2GL3;
import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDebugListener;
@@ -74,7 +74,7 @@ public abstract class GLContextImpl extends GLContext {
private String contextFQN;
private int additionalCtxCreationFlags;
-
+
// Cache of the functions that are available to be called at the current
// moment in time
protected ExtensionAvailabilityCache extensionAvailability;
@@ -84,14 +84,14 @@ public abstract class GLContextImpl extends GLContext {
private String glRenderer;
private String glRendererLowerCase;
-
+
// Tracks creation and initialization of buffer objects to avoid
// repeated glGet calls upon glMapBuffer operations
private GLBufferSizeTracker bufferSizeTracker; // Singleton - Set by GLContextShareSet
private GLBufferStateTracker bufferStateTracker = new GLBufferStateTracker();
private GLStateTracker glStateTracker = new GLStateTracker();
private GLDebugMessageHandler glDebugHandler = null;
-
+
protected GLDrawableImpl drawable;
protected GLDrawableImpl drawableRead;
@@ -112,9 +112,9 @@ public abstract class GLContextImpl extends GLContext {
public static void shutdownImpl() {
mappedExtensionAvailabilityCache.clear();
mappedGLProcAddress.clear();
- mappedGLXProcAddress.clear();
+ mappedGLXProcAddress.clear();
}
-
+
public GLContextImpl(GLDrawableImpl drawable, GLContext shareWith) {
super();
@@ -125,7 +125,7 @@ public abstract class GLContextImpl extends GLContext {
this.drawable = drawable;
this.drawableRead = drawable;
-
+
this.glDebugHandler = new GLDebugMessageHandler(this);
}
@@ -156,10 +156,11 @@ public abstract class GLContextImpl extends GLContext {
glRenderer = "";
glRendererLowerCase = glRenderer;
-
+
super.resetStates();
}
+ @Override
public final void setGLReadDrawable(GLDrawable read) {
if(null!=read && drawable!=read && !isGLReadDrawableAvailable()) {
throw new GLException("GL Read Drawable not available");
@@ -174,10 +175,12 @@ public abstract class GLContextImpl extends GLContext {
}
}
+ @Override
public final GLDrawable getGLReadDrawable() {
return drawableRead;
}
+ @Override
public final GLDrawable getGLDrawable() {
return drawable;
}
@@ -186,10 +189,12 @@ public abstract class GLContextImpl extends GLContext {
return (GLDrawableImpl) getGLDrawable();
}
+ @Override
public final GL getGL() {
return gl;
}
+ @Override
public GL setGL(GL gl) {
if(DEBUG) {
String sgl1 = (null!=this.gl)?this.gl.getClass().getSimpleName()+", "+this.gl.toString():"<null>";
@@ -204,12 +209,12 @@ public abstract class GLContextImpl extends GLContext {
/**
* Call this method to notify the OpenGL context
* that the drawable has changed (size or position).
- *
+ *
* <p>
- * This is currently being used and overridden by Mac OSX,
+ * This is currently being used and overridden by Mac OSX,
* which issues the {@link jogamp.opengl.macosx.cgl.CGL#updateContext(long) NSOpenGLContext update()} call.
* </p>
- *
+ *
* @throws GLException
*/
protected void drawableUpdatedNotify() throws GLException { }
@@ -217,6 +222,7 @@ public abstract class GLContextImpl extends GLContext {
public abstract Object getPlatformGLExtensions();
// Note: the surface is locked within [makeCurrent .. swap .. release]
+ @Override
public void release() throws GLException {
release(false);
}
@@ -228,7 +234,7 @@ public abstract class GLContextImpl extends GLContext {
throw new GLException("Context not current on current thread "+Thread.currentThread().getName()+": "+this);
}
final boolean actualRelease = force || lock.getHoldCount() == 1 ;
- try {
+ try {
if( actualRelease ) {
if (contextHandle != 0) { // allow dbl-release
releaseImpl();
@@ -248,8 +254,9 @@ public abstract class GLContextImpl extends GLContext {
}
protected abstract void releaseImpl() throws GLException;
+ @Override
public final void destroy() {
- if (DEBUG || TRACE_SWITCH) {
+ if (DEBUG || TRACE_SWITCH) {
System.err.println(getThreadName() + ": GLContextImpl.destroy.0: " + toHexString(contextHandle) +
", isShared "+GLContextShareSet.isShared(this)+" - "+lock);
}
@@ -268,7 +275,7 @@ public abstract class GLContextImpl extends GLContext {
if ( lock.getHoldCount() > 2 ) {
throw new GLException(getThreadName() + ": Lock was hold more than once - makeCurrent/release imbalance: "+lock);
}
- try {
+ try {
// release current context
if(null != glDebugHandler) {
if(lock.getHoldCount() == 1) {
@@ -279,7 +286,7 @@ public abstract class GLContextImpl extends GLContext {
}
if(lock.getHoldCount() > 1) {
// pending release() after makeCurrent()
- release(true);
+ release(true);
}
destroyImpl();
contextHandle = 0;
@@ -303,6 +310,7 @@ public abstract class GLContextImpl extends GLContext {
}
protected abstract void destroyImpl() throws GLException;
+ @Override
public final void copy(GLContext source, int mask) throws GLException {
if (source.getHandle() == 0) {
throw new GLException("Source OpenGL context has not been created");
@@ -364,6 +372,7 @@ public abstract class GLContextImpl extends GLContext {
* @see #mapVersionAvailable
* @see #destroyContextARBImpl
*/
+ @Override
public int makeCurrent() throws GLException {
boolean unlockContextAndDrawable = false;
int res = CONTEXT_NOT_CURRENT;
@@ -377,9 +386,9 @@ public abstract class GLContextImpl extends GLContext {
if (NativeSurface.LOCK_SURFACE_CHANGED == lockRes) {
drawable.updateHandle();
}
-
+
lock.lock();
- try {
+ try {
// One context can only be current by one thread,
// and one thread can only have one context current!
final GLContext current = getCurrent();
@@ -395,13 +404,13 @@ public abstract class GLContextImpl extends GLContext {
} else {
current.release();
}
- }
+ }
if (0 == drawable.getHandle()) {
throw new GLException("drawable has invalid handle: "+drawable);
}
res = makeCurrentWithinLock(lockRes);
unlockContextAndDrawable = CONTEXT_NOT_CURRENT == res;
-
+
/**
* FIXME: refactor dependence on Java 2D / JOGL bridge
if ((tracker != null) &&
@@ -416,7 +425,7 @@ public abstract class GLContextImpl extends GLContext {
} finally {
if (unlockContextAndDrawable) {
lock.unlock();
- }
+ }
}
} catch (RuntimeException e) {
unlockContextAndDrawable = true;
@@ -424,9 +433,9 @@ public abstract class GLContextImpl extends GLContext {
} finally {
if (unlockContextAndDrawable) {
drawable.unlockSurface();
- }
+ }
}
-
+
if (res == CONTEXT_NOT_CURRENT) {
if(TRACE_SWITCH) {
System.err.println(getThreadName() +": GLContext.ContextSwitch: - switch - CONTEXT_NOT_CURRENT - "+lock);
@@ -435,9 +444,9 @@ public abstract class GLContextImpl extends GLContext {
setCurrent(this);
if(res == CONTEXT_CURRENT_NEW) {
// check if the drawable's and the GL's GLProfile are equal
- // throws an GLException if not
+ // throws an GLException if not
getGLDrawable().getGLProfile().verifyEquality(gl.getGLProfile());
-
+
glDebugHandler.init( isGL2GL3() && isGLDebugEnabled() );
if(DEBUG_GL) {
@@ -448,7 +457,7 @@ public abstract class GLContextImpl extends GLContext {
}
if(TRACE_GL) {
gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) );
- }
+ }
if(DEBUG || TRACE_SWITCH) {
System.err.println(getThreadName() +": GLContext.ContextSwitch: - switch - CONTEXT_CURRENT_NEW - "+lock);
}
@@ -474,7 +483,7 @@ public abstract class GLContextImpl extends GLContext {
// only impacts w/ createContextARB(..)
additionalCtxCreationFlags |= GLContext.CTX_OPTION_DEBUG ;
}
-
+
final GLContextImpl shareWith = (GLContextImpl) GLContextShareSet.getShareContext(this);
if (null != shareWith) {
shareWith.getDrawableImpl().lockSurface();
@@ -485,7 +494,7 @@ public abstract class GLContextImpl extends GLContext {
} finally {
if (null != shareWith) {
shareWith.getDrawableImpl().unlockSurface();
- }
+ }
}
if (DEBUG) {
if(created) {
@@ -493,16 +502,16 @@ public abstract class GLContextImpl extends GLContext {
} else {
System.err.println(getThreadName() + ": Create GL context FAILED for " + getClass().getName());
}
- }
+ }
if(!created) {
return CONTEXT_NOT_CURRENT;
}
-
+
// finalize mapping the available GLVersions, in case it's not done yet
- {
+ {
final AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice device = config.getScreen().getDevice();
-
+
if( !GLContext.getAvailableGLVersionsSet(device) ) {
final int reqMajor;
final int reqProfile;
@@ -511,7 +520,7 @@ public abstract class GLContextImpl extends GLContext {
reqMajor = ctxMajorVersion;
reqProfile = GLContext.CTX_PROFILE_ES;
} else {
- if(ctxMajorVersion<3 || ctxMajorVersion==3 && ctxMinorVersion==0) {
+ if(ctxMajorVersion<3 || ctxMajorVersion==3 && ctxMinorVersion==0) {
reqMajor = 2;
} else {
reqMajor = ctxMajorVersion;
@@ -537,30 +546,30 @@ public abstract class GLContextImpl extends GLContext {
return CONTEXT_CURRENT;
}
protected abstract void makeCurrentImpl() throws GLException;
-
- /**
+
+ /**
* Platform dependent entry point for context creation.<br>
*
* This method is called from {@link #makeCurrentWithinLock()} .. {@link #makeCurrent()} .<br>
*
- * The implementation shall verify this context with a
+ * The implementation shall verify this context with a
* <code>MakeContextCurrent</code> call.<br>
*
* The implementation <b>must</b> leave the context current.<br>
- *
+ *
* @param share the shared context or null
* @return the valid and current context if successful, or null
* @throws GLException
*/
protected abstract boolean createImpl(GLContextImpl sharedWith) throws GLException ;
- /**
+ /**
* Platform dependent but harmonized implementation of the <code>ARB_create_context</code>
* mechanism to create a context.<br>
*
* This method is called from {@link #createContextARB}, {@link #createImpl(GLContextImpl)} .. {@link #makeCurrent()} .<br>
*
- * The implementation shall verify this context with a
+ * The implementation shall verify this context with a
* <code>MakeContextCurrent</code> call.<br>
*
* The implementation <b>must</b> leave the context current.<br>
@@ -582,7 +591,7 @@ public abstract class GLContextImpl extends GLContext {
* @see #createContextARBImpl
* @see #destroyContextARBImpl
*/
- protected abstract long createContextARBImpl(long share, boolean direct, int ctxOptionFlags,
+ protected abstract long createContextARBImpl(long share, boolean direct, int ctxOptionFlags,
int major, int minor);
/**
@@ -616,7 +625,7 @@ public abstract class GLContextImpl extends GLContext {
* @see #createContextARBImpl
* @see #destroyContextARBImpl
*/
- protected final long createContextARB(long share, boolean direct)
+ protected final long createContextARB(long share, boolean direct)
{
AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration();
AbstractGraphicsDevice device = config.getScreen().getDevice();
@@ -631,7 +640,7 @@ public abstract class GLContextImpl extends GLContext {
if ( !GLContext.getAvailableGLVersionsSet(device) ) {
if(!mapGLVersions(device)) {
- // none of the ARB context creation calls was successful, bail out
+ // none of the ARB context creation calls was successful, bail out
return 0;
}
}
@@ -662,13 +671,13 @@ public abstract class GLContextImpl extends GLContext {
return _ctx;
}
- private final boolean mapGLVersions(AbstractGraphicsDevice device) {
+ private final boolean mapGLVersions(AbstractGraphicsDevice device) {
synchronized (GLContext.deviceVersionAvailable) {
boolean success = false;
// Following GLProfile.GL_PROFILE_LIST_ALL order of profile detection { GL4bc, GL3bc, GL2, GL4, GL3, GL2GL3, GLES2, GL2ES2, GLES1, GL2ES1 }
success |= createContextARBMapVersionsAvailable(4, true /* compat */); // GL4bc
success |= createContextARBMapVersionsAvailable(3, true /* compat */); // GL3bc
- success |= createContextARBMapVersionsAvailable(2, true /* compat */); // GL2
+ success |= createContextARBMapVersionsAvailable(2, true /* compat */); // GL2
success |= createContextARBMapVersionsAvailable(4, false /* core */); // GL4
success |= createContextARBMapVersionsAvailable(3, false /* core */); // GL3
if(success) {
@@ -676,7 +685,7 @@ public abstract class GLContextImpl extends GLContext {
GLContext.setAvailableGLVersionsSet(device);
} else if (DEBUG) {
System.err.println(getThreadName() + ": createContextARB-MapVersions NONE for :"+device);
- }
+ }
return success;
}
}
@@ -704,12 +713,12 @@ public abstract class GLContextImpl extends GLContext {
majorMax=3; minorMax=GLContext.getMaxMinor(majorMax);
majorMin=3; minorMin=1;
} else /* if( glp.isGL2() ) */ {
- // our minimum desktop OpenGL runtime requirements are 1.1,
- // nevertheless we restrict ARB context creation to 2.0 to spare us futile attempts
+ // our minimum desktop OpenGL runtime requirements are 1.1,
+ // nevertheless we restrict ARB context creation to 2.0 to spare us futile attempts
majorMax=3; minorMax=0;
majorMin=2; minorMin=0;
}
- _context = createContextARBVersions(0, true, ctp,
+ _context = createContextARBVersions(0, true, ctp,
/* max */ majorMax, minorMax,
/* min */ majorMin, minorMin,
/* res */ major, minor);
@@ -718,7 +727,7 @@ public abstract class GLContextImpl extends GLContext {
// try w/ FORWARD instead of CORE
ctp &= ~CTX_PROFILE_CORE ;
ctp |= CTX_OPTION_FORWARD ;
- _context = createContextARBVersions(0, true, ctp,
+ _context = createContextARBVersions(0, true, ctp,
/* max */ majorMax, minorMax,
/* min */ majorMin, minorMin,
/* res */ major, minor);
@@ -727,15 +736,15 @@ public abstract class GLContextImpl extends GLContext {
ctp &= ~CTX_PROFILE_CORE ;
ctp &= ~CTX_OPTION_FORWARD ;
ctp |= CTX_PROFILE_COMPAT ;
- _context = createContextARBVersions(0, true, ctp,
+ _context = createContextARBVersions(0, true, ctp,
/* max */ majorMax, minorMax,
/* min */ majorMin, minorMin,
/* res */ major, minor);
}
}
if(0!=_context) {
- AbstractGraphicsDevice device = drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
- // ctxMajorVersion, ctxMinorVersion, ctxOptions is being set by
+ AbstractGraphicsDevice device = drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
+ // ctxMajorVersion, ctxMinorVersion, ctxOptions is being set by
// createContextARBVersions(..) -> setGLFunctionAvailbility(..) -> setContextVersion(..)
GLContext.mapAvailableGLVersion(device, reqMajor, reqProfile, ctxMajorVersion, ctxMinorVersion, ctxOptions);
destroyContextARBImpl(_context);
@@ -743,19 +752,19 @@ public abstract class GLContextImpl extends GLContext {
System.err.println(getThreadName() + ": createContextARB-MapVersionsAvailable HAVE: " +reqMajor+"."+reqProfile+ " -> "+getGLVersion());
}
// only reset [and hence modify] this context state if ARB context creation was successful
- resetStates();
+ resetStates();
return true;
} else {
if (DEBUG) {
System.err.println(getThreadName() + ": createContextARB-MapVersionsAvailable NOPE: "+reqMajor+"."+reqProfile);
- }
+ }
return false;
}
}
- private final long createContextARBVersions(long share, boolean direct, int ctxOptionFlags,
- int majorMax, int minorMax,
- int majorMin, int minorMin,
+ private final long createContextARBVersions(long share, boolean direct, int ctxOptionFlags,
+ int majorMax, int minorMax,
+ int majorMin, int minorMin,
int major[], int minor[]) {
major[0]=majorMax;
minor[0]=minorMax;
@@ -773,15 +782,15 @@ public abstract class GLContextImpl extends GLContext {
if(0 != _context) {
ok = true;
- setGLFunctionAvailability(true, major[0], minor[0], ctxOptionFlags);
+ setGLFunctionAvailability(true, major[0], minor[0], ctxOptionFlags);
} else {
- ok = false;
+ ok = false;
}
-
+
if(ok && major[0]>=3) {
int[] hasMajor = new int[1]; int[] hasMinor = new int[1];
- gl.glGetIntegerv(GL3.GL_MAJOR_VERSION, hasMajor, 0);
- gl.glGetIntegerv(GL3.GL_MINOR_VERSION, hasMinor, 0);
+ gl.glGetIntegerv(GL2GL3.GL_MAJOR_VERSION, hasMajor, 0);
+ gl.glGetIntegerv(GL2GL3.GL_MINOR_VERSION, hasMinor, 0);
ok = hasMajor[0]>major[0] || ( hasMajor[0]==major[0] && hasMinor[0]>=minor[0] ) ;
if(!ok) {
removeCachedVersion(major[0], minor[0], ctxOptionFlags);
@@ -792,7 +801,7 @@ public abstract class GLContextImpl extends GLContext {
System.err.println(getThreadName() + ": createContextARBVersions: version verification - expected "+major[0]+"."+minor[0]+", has "+hasMajor[0]+"."+hasMinor[0]+" == "+ok);
}
}
-
+
if(!ok) {
if(!GLContext.decrementGLVersion(major, minor)) break;
}
@@ -805,8 +814,8 @@ public abstract class GLContextImpl extends GLContext {
// As a last resort, the GL_VERSION string may be used ..
//
- /**
- * If major > 0 || minor > 0 : Use passed values, determined at creation time
+ /**
+ * If major > 0 || minor > 0 : Use passed values, determined at creation time
* If major==0 && minor == 0 : Use GL_VERSION
* Otherwise .. don't touch ..
*/
@@ -870,7 +879,7 @@ public abstract class GLContextImpl extends GLContext {
/** Create the GL for this context. */
protected GL createGL(GLProfile glp) {
GL gl = (GL) createInstance(glp, "Impl", new Class[] { GLProfile.class, GLContextImpl.class }, new Object[] { glp, this } );
-
+
/* FIXME: refactor dependence on Java 2D / JOGL bridge
if (tracker != null) {
gl.setObjectTracker(tracker);
@@ -878,11 +887,11 @@ public abstract class GLContextImpl extends GLContext {
*/
return gl;
}
-
+
public final ProcAddressTable getGLProcAddressTable() {
return glProcAddressTable;
}
-
+
/**
* Shall return the platform extension ProcAddressTable,
* ie for GLXExt, EGLExt, ..
@@ -918,8 +927,8 @@ public abstract class GLContextImpl extends GLContext {
/** Maps the given "platform-independent" extension name to a real
function name. Currently this is only used to map
- "GL_ARB_pbuffer" to "WGL_ARB_pbuffer/GLX_SGIX_pbuffer" and
- "GL_ARB_pixel_format" to "WGL_ARB_pixel_format/n.a."
+ "GL_ARB_pbuffer" to "WGL_ARB_pbuffer/GLX_SGIX_pbuffer" and
+ "GL_ARB_pixel_format" to "WGL_ARB_pixel_format/n.a."
*/
protected final String mapToRealGLExtensionName(String glExtensionName) {
Map<String, String> map = getExtensionNameMap();
@@ -943,24 +952,24 @@ public abstract class GLContextImpl extends GLContext {
if(0 == _glGetString) {
// FIXME
System.err.println("Warning: Entry point to 'glGetString' is NULL.");
- Thread.dumpStack();
+ Thread.dumpStack();
} else {
final String _glRenderer = glGetStringInt(GL.GL_RENDERER, _glGetString);
if(null == _glRenderer) {
// FIXME
System.err.println("Warning: GL_RENDERER is NULL.");
- Thread.dumpStack();
+ Thread.dumpStack();
} else {
glRenderer = _glRenderer;
glRendererLowerCase = glRenderer.toLowerCase();
}
}
}
-
+
protected final String getGLRendererString(boolean lowerCase) {
return lowerCase ? glRendererLowerCase : glRenderer;
}
-
+
/**
* Sets the OpenGL implementation class and
* the cache of which GL functions are available for calling through this
@@ -975,7 +984,7 @@ public abstract class GLContextImpl extends GLContext {
* @param major OpenGL major version
* @param minor OpenGL minor version
* @param ctxProfileBits OpenGL context profile and option bits, see {@link javax.media.opengl.GLContext#CTX_OPTION_ANY}
- *
+ *
* @see #setContextVersion
* @see javax.media.opengl.GLContext#CTX_OPTION_ANY
* @see javax.media.opengl.GLContext#CTX_PROFILE_COMPAT
@@ -992,13 +1001,13 @@ public abstract class GLContextImpl extends GLContext {
updateGLXProcAddressTable();
initGLRendererStrings();
-
+
if(!isCurrentContextHardwareRasterizer()) {
ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT;
- }
+ }
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
-
+
contextFQN = getContextFQN(adevice, major, minor, ctxProfileBits);
if (DEBUG) {
System.err.println(getThreadName() + ": Context FQN: "+contextFQN+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, null));
@@ -1011,7 +1020,7 @@ public abstract class GLContextImpl extends GLContext {
synchronized(mappedContextTypeObjectLock) {
table = mappedGLProcAddress.get( contextFQN );
if(null != table && !verifyInstance(gl.getGLProfile(), "ProcAddressTable", table)) {
- throw new InternalError("GLContext GL ProcAddressTable mapped key("+contextFQN+" - " + GLContext.getGLVersion(major, minor, ctxProfileBits, null)+
+ throw new InternalError("GLContext GL ProcAddressTable mapped key("+contextFQN+" - " + GLContext.getGLVersion(major, minor, ctxProfileBits, null)+
") -> "+ table.getClass().getName()+" not matching "+gl.getGLProfile().getGLImplBaseClassName());
}
}
@@ -1032,7 +1041,7 @@ public abstract class GLContextImpl extends GLContext {
}
}
}
-
+
//
// Update ExtensionAvailabilityCache
//
@@ -1055,16 +1064,16 @@ public abstract class GLContextImpl extends GLContext {
System.err.println(getThreadName() + ": GLContext GL ExtensionAvailabilityCache mapping key("+contextFQN+") -> "+toHexString(extensionAvailability.hashCode()) + " - entries: "+extensionAvailability.getTotalExtensionCount());
}
}
- }
+ }
if( isExtensionAvailable("GL_ARB_ES2_compatibility") ) {
ctxProfileBits |= CTX_IMPL_ES2_COMPAT;
}
-
+
//
// Set GL Version (complete w/ version string)
//
setContextVersion(major, minor, ctxProfileBits, true);
-
+
setDefaultSwapInterval();
}
@@ -1074,7 +1083,7 @@ public abstract class GLContextImpl extends GLContext {
}
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
-
+
contextFQN = getContextFQN(adevice, major, minor, ctxProfileBits);
if (DEBUG) {
System.err.println(getThreadName() + ": RM Context FQN: "+contextFQN+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, null));
@@ -1097,26 +1106,27 @@ public abstract class GLContextImpl extends GLContext {
private final boolean isCurrentContextHardwareRasterizer() {
boolean isHardwareRasterizer = true;
-
+
if(!drawable.getChosenGLCapabilities().getHardwareAccelerated()) {
isHardwareRasterizer = false;
} else {
isHardwareRasterizer = ! ( glRendererLowerCase.contains("software") /* Mesa3D */ ||
glRendererLowerCase.contains("mesa x11") /* Mesa3D*/ ||
glRendererLowerCase.contains("softpipe") /* Gallium */ ||
- glRendererLowerCase.contains("llvmpipe") /* Gallium */
+ glRendererLowerCase.contains("llvmpipe") /* Gallium */
);
}
return isHardwareRasterizer;
}
-
+
/**
* Updates the platform's 'GLX' function cache
*/
protected abstract void updateGLXProcAddressTable();
protected abstract StringBuilder getPlatformExtensionsStringImpl();
-
+
+ @Override
public final boolean isFunctionAvailable(String glFunctionName) {
// Check GL 1st (cached)
if(null!=glProcAddressTable) { // null if this context wasn't not created
@@ -1128,8 +1138,8 @@ public abstract class GLContextImpl extends GLContext {
}
// Check platform extensions 2nd (cached) - context had to be enabled once
- final ProcAddressTable pTable = getPlatformExtProcAddressTable();
- if(null!=pTable) {
+ final ProcAddressTable pTable = getPlatformExtProcAddressTable();
+ if(null!=pTable) {
try {
if(0!=pTable.getAddressFor(glFunctionName)) {
return true;
@@ -1154,6 +1164,7 @@ public abstract class GLContextImpl extends GLContext {
return false;
}
+ @Override
public boolean isExtensionAvailable(String glExtensionName) {
if(null!=extensionAvailability) {
return extensionAvailability.isExtensionAvailable(mapToRealGLExtensionName(glExtensionName));
@@ -1161,10 +1172,12 @@ public abstract class GLContextImpl extends GLContext {
return false;
}
+ @Override
public final int getPlatformExtensionCount() {
return null != extensionAvailability ? extensionAvailability.getPlatformExtensionCount() : 0;
}
-
+
+ @Override
public final String getPlatformExtensionsString() {
if(null!=extensionAvailability) {
return extensionAvailability.getPlatformExtensionsString();
@@ -1172,10 +1185,12 @@ public abstract class GLContextImpl extends GLContext {
return null;
}
+ @Override
public final int getGLExtensionCount() {
return null != extensionAvailability ? extensionAvailability.getGLExtensionCount() : 0;
}
-
+
+ @Override
public final String getGLExtensionsString() {
if(null!=extensionAvailability) {
return extensionAvailability.getGLExtensionsString();
@@ -1189,11 +1204,11 @@ public abstract class GLContextImpl extends GLContext {
}
return false;
}
-
+
protected static String getContextFQN(AbstractGraphicsDevice device, int major, int minor, int ctxProfileBits) {
// remove non-key values
- ctxProfileBits &= ~( GLContext.CTX_OPTION_DEBUG | GLContext.CTX_IMPL_ES2_COMPAT ) ;
-
+ ctxProfileBits &= ~( GLContext.CTX_OPTION_DEBUG | GLContext.CTX_IMPL_ES2_COMPAT ) ;
+
return device.getUniqueID() + "-" + toHexString(composeBits(major, minor, ctxProfileBits));
}
@@ -1220,7 +1235,7 @@ public abstract class GLContextImpl extends GLContext {
//----------------------------------------------------------------------
// Helpers for buffer object optimizations
-
+
public void setBufferSizeTracker(GLBufferSizeTracker bufferSizeTracker) {
this.bufferSizeTracker = bufferSizeTracker;
}
@@ -1245,35 +1260,42 @@ public abstract class GLContextImpl extends GLContext {
public boolean hasWaiters() {
return lock.getQueueLength()>0;
}
-
+
//---------------------------------------------------------------------------
// GL_ARB_debug_output, GL_AMD_debug_output helpers
//
+ @Override
public final String getGLDebugMessageExtension() {
return glDebugHandler.getExtension();
}
+ @Override
public final boolean isGLDebugMessageEnabled() {
return glDebugHandler.isEnabled();
}
-
+
+ @Override
public final int getContextCreationFlags() {
- return additionalCtxCreationFlags;
+ return additionalCtxCreationFlags;
}
+ @Override
public final void setContextCreationFlags(int flags) {
if(!isCreated()) {
additionalCtxCreationFlags = flags & GLContext.CTX_OPTION_DEBUG;
}
}
-
- public final boolean isGLDebugSynchronous() { return glDebugHandler.isSynchronous(); }
-
+
+ @Override
+ public final boolean isGLDebugSynchronous() { return glDebugHandler.isSynchronous(); }
+
+ @Override
public final void setGLDebugSynchronous(boolean synchronous) {
glDebugHandler.setSynchronous(synchronous);
}
-
+
+ @Override
public final void enableGLDebugMessage(boolean enable) throws GLException {
if(!isCreated()) {
if(enable) {
@@ -1286,23 +1308,27 @@ public abstract class GLContextImpl extends GLContext {
glDebugHandler.enable(enable);
}
}
-
- public final void addGLDebugListener(GLDebugListener listener) {
+
+ @Override
+ public final void addGLDebugListener(GLDebugListener listener) {
glDebugHandler.addListener(listener);
}
-
+
+ @Override
public final void removeGLDebugListener(GLDebugListener listener) {
glDebugHandler.removeListener(listener);
- }
-
+ }
+
+ @Override
public final void glDebugMessageControl(int source, int type, int severity, int count, IntBuffer ids, boolean enabled) {
if(glDebugHandler.isExtensionARB()) {
gl.getGL2GL3().glDebugMessageControlARB(source, type, severity, count, ids, enabled);
} else if(glDebugHandler.isExtensionAMD()) {
gl.getGL2GL3().glDebugMessageEnableAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, count, ids, enabled);
- }
+ }
}
-
+
+ @Override
public final void glDebugMessageControl(int source, int type, int severity, int count, int[] ids, int ids_offset, boolean enabled) {
if(glDebugHandler.isExtensionARB()) {
gl.getGL2GL3().glDebugMessageControlARB(source, type, severity, count, ids, ids_offset, enabled);
@@ -1310,16 +1336,17 @@ public abstract class GLContextImpl extends GLContext {
gl.getGL2GL3().glDebugMessageEnableAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, count, ids, ids_offset, enabled);
}
}
-
+
+ @Override
public final void glDebugMessageInsert(int source, int type, int id, int severity, String buf) {
final int len = (null != buf) ? buf.length() : 0;
if(glDebugHandler.isExtensionARB()) {
gl.getGL2GL3().glDebugMessageInsertARB(source, type, id, severity, len, buf);
} else if(glDebugHandler.isExtensionAMD()) {
gl.getGL2GL3().glDebugMessageInsertAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, id, len, buf);
- }
+ }
}
-
+
/** Internal bootstraping glGetString(GL_RENDERER) */
protected static native String glGetStringInt(int name, long procAddress);
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index f5f9f62c4..06cd550b4 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2011 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -75,7 +75,8 @@ public abstract class EGLContext extends GLContextImpl {
// no inner state _eglExt = null;
super.resetStates();
}
-
+
+ @Override
public Object getPlatformGLExtensions() {
return getEGLExt();
}
@@ -87,6 +88,7 @@ public abstract class EGLContext extends GLContextImpl {
return _eglExt;
}
+ @Override
public final ProcAddressTable getPlatformExtProcAddressTable() {
return eglExtProcAddressTable;
}
@@ -95,14 +97,18 @@ public abstract class EGLContext extends GLContextImpl {
return eglExtProcAddressTable;
}
+ @Override
protected Map<String, String> getFunctionNameMap() { return null; }
+ @Override
protected Map<String, String> getExtensionNameMap() { return null; }
+ @Override
public final boolean isGLReadDrawableAvailable() {
return true;
}
+ @Override
protected void makeCurrentImpl() throws GLException {
if(EGL.EGL_NO_DISPLAY==((EGLDrawable)drawable).getDisplay() ) {
throw new GLException("drawable not properly initialized, NO DISPLAY: "+drawable);
@@ -118,6 +124,7 @@ public abstract class EGLContext extends GLContextImpl {
}
}
+ @Override
protected void releaseImpl() throws GLException {
if (!EGL.eglMakeCurrent(((EGLDrawable)drawable).getDisplay(),
EGL.EGL_NO_SURFACE,
@@ -128,6 +135,7 @@ public abstract class EGLContext extends GLContextImpl {
}
}
+ @Override
protected void destroyImpl() throws GLException {
if (!EGL.eglDestroyContext(((EGLDrawable)drawable).getDisplay(), contextHandle)) {
final int eglError = EGL.eglGetError();
@@ -138,14 +146,17 @@ public abstract class EGLContext extends GLContextImpl {
}
}
+ @Override
protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
return 0; // FIXME
}
+ @Override
protected void destroyContextARBImpl(long _context) {
// FIXME
}
+ @Override
protected boolean createImpl(GLContextImpl shareWith) throws GLException {
long eglDisplay = ((EGLDrawable)drawable).getDisplay();
EGLGraphicsConfiguration config = ((EGLDrawable)drawable).getGraphicsConfiguration();
@@ -178,7 +189,7 @@ public abstract class EGLContext extends GLContextImpl {
}
}
- final IntBuffer contextAttrsNIO;
+ final IntBuffer contextAttrsNIO;
{
final int[] contextAttrs = new int[] {
EGL.EGL_CONTEXT_CLIENT_VERSION, -1,
@@ -200,7 +211,7 @@ public abstract class EGLContext extends GLContextImpl {
}
if (DEBUG) {
System.err.println(getThreadName() + ": Created OpenGL context 0x" +
- Long.toHexString(contextHandle) +
+ Long.toHexString(contextHandle) +
",\n\twrite surface 0x" + Long.toHexString(drawable.getHandle()) +
",\n\tread surface 0x" + Long.toHexString(drawableRead.getHandle())+
",\n\t"+this+
@@ -218,13 +229,14 @@ public abstract class EGLContext extends GLContextImpl {
if(glProfile.usesNativeGLES2()) {
ctp |= CTX_IMPL_ES2_COMPAT;
major = 2;
- } else {
+ } else {
major = 1;
}
setGLFunctionAvailability(true, major, 0, ctp);
return true;
}
+ @Override
protected final void updateGLXProcAddressTable() {
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
@@ -255,16 +267,17 @@ public abstract class EGLContext extends GLContextImpl {
}
}
}
-
+
+ @Override
protected final StringBuilder getPlatformExtensionsStringImpl() {
- StringBuilder sb = new StringBuilder();
+ StringBuilder sb = new StringBuilder();
if (!eglQueryStringInitialized) {
eglQueryStringAvailable =
getDrawableImpl().getGLDynamicLookupHelper().dynamicLookupFunction("eglQueryString") != 0;
eglQueryStringInitialized = true;
}
if (eglQueryStringAvailable) {
- final String ret = EGL.eglQueryString(((EGLDrawable)drawable).getDisplay(),
+ final String ret = EGL.eglQueryString(((EGLDrawable)drawable).getDisplay(),
EGL.EGL_EXTENSIONS);
if (DEBUG) {
System.err.println("EGL extensions: " + ret);
@@ -289,8 +302,10 @@ public abstract class EGLContext extends GLContextImpl {
return EGL.eglSwapInterval(((EGLDrawable)drawable).getDisplay(), interval);
}
+ @Override
public abstract void bindPbufferToTexture();
+ @Override
public abstract void releasePbufferFromTexture();
protected static String toHexString(int hex) {
@@ -299,24 +314,28 @@ public abstract class EGLContext extends GLContextImpl {
protected static String toHexString(long hex) {
return GLContext.toHexString(hex);
}
-
+
//----------------------------------------------------------------------
// Currently unimplemented stuff
//
+ @Override
protected void copyImpl(GLContext source, int mask) throws GLException {
throw new GLException("Not yet implemented");
}
+ @Override
public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) {
throw new GLException("Should not call this");
}
+ @Override
public boolean offscreenImageNeedsVerticalFlip() {
throw new GLException("Should not call this");
}
+ @Override
public int getOffscreenContextPixelDataType() {
throw new GLException("Should not call this");
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
index ff60a5262..0a451e5eb 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,7 +28,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -49,6 +49,7 @@ public class EGLExternalContext extends EGLContext {
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
+ @Override
public int makeCurrent() throws GLException {
// Save last context if necessary to allow external GLContexts to
// talk to other GLContexts created by this library
@@ -58,27 +59,33 @@ public class EGLExternalContext extends EGLContext {
setCurrent(null);
}
return super.makeCurrent();
- }
+ }
+ @Override
public void release() throws GLException {
super.release();
setCurrent(lastContext);
lastContext = null;
}
+ @Override
protected void makeCurrentImpl() throws GLException {
}
+ @Override
protected void releaseImpl() throws GLException {
}
+ @Override
protected void destroyImpl() throws GLException {
}
+ @Override
public void bindPbufferToTexture() {
throw new GLException("Should not call this");
}
+ @Override
public void releasePbufferFromTexture() {
throw new GLException("Should not call this");
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenContext.java
index dd0a3db3a..eae47fa92 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,29 +28,26 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
package jogamp.opengl.egl;
-import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import jogamp.opengl.*;
-import com.jogamp.gluegen.runtime.ProcAddressTable;
-import java.nio.*;
-import java.util.*;
public class EGLOnscreenContext extends EGLContext {
public EGLOnscreenContext(EGLOnscreenDrawable drawable, GLContext shareWith) {
super(drawable, shareWith);
}
+ @Override
public void bindPbufferToTexture() {
throw new GLException("Should not call this");
}
+ @Override
public void releasePbufferFromTexture() {
throw new GLException("Should not call this");
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferContext.java
index 2cad7daac..7175d516f 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,33 +28,31 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
package jogamp.opengl.egl;
-import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import jogamp.opengl.*;
-import com.jogamp.gluegen.runtime.ProcAddressTable;
-import java.nio.*;
-import java.util.*;
public class EGLPbufferContext extends EGLContext {
public EGLPbufferContext(EGLPbufferDrawable drawable, GLContext shareWith) {
super(drawable, shareWith);
}
+ @Override
public int getFloatingPointMode() {
return 0; // FIXME ??
}
+ @Override
public void bindPbufferToTexture() {
throw new GLException("Not yet implemented");
}
+ @Override
public void releasePbufferFromTexture() {
throw new GLException("Not yet implemented");
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 3cd4b340c..aa66aa9d1 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -65,7 +65,7 @@ import com.jogamp.gluegen.runtime.ProcAddressTable;
import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver;
public abstract class MacOSXCGLContext extends GLContextImpl
-{
+{
// Abstract interface for implementation of this context (either
// NSOpenGL-based or CGL-based)
protected interface GLBackendImpl {
@@ -78,7 +78,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
boolean setSwapInterval(int interval);
boolean swapBuffers();
}
-
+
/* package */ static final boolean isTigerOrLater;
/* package */ static final boolean isLionOrLater;
@@ -91,7 +91,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
static boolean isGLProfileSupported(int ctp, int major, int minor) {
boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ;
boolean ctCore = 0 != ( CTX_PROFILE_CORE & ctp ) ;
-
+
// We exclude 3.0, since we would map it's core to GL2. Hence we force mapping 2.1 to GL2
if(3==major && 1<=minor && minor<=2) {
// [3.1..3.2] -> GL3*
@@ -119,26 +119,26 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return CGL.kCGLOGLPVersion_3_2_Core;
} else {
return CGL.kCGLOGLPVersion_Legacy;
- }
- }
+ }
+ }
private boolean haveSetOpenGLMode = false;
private GLBackendType openGLMode = GLBackendType.NSOPENGL;
-
+
// Implementation object (either NSOpenGL-based or CGL-based)
protected GLBackendImpl impl;
-
+
private CGLExt _cglExt;
// Table that holds the addresses of the native C-language entry points for
// CGL extension functions.
private CGLExtProcAddressTable cglExtProcAddressTable;
-
+
protected MacOSXCGLContext(GLDrawableImpl drawable,
GLContext shareWith) {
super(drawable, shareWith);
initOpenGLImpl(getOpenGLMode());
}
-
+
@Override
protected void resetStates() {
// no inner state _cglExt = null;
@@ -146,12 +146,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
super.resetStates();
}
+ @Override
public Object getPlatformGLExtensions() {
return getCGLExt();
}
- protected boolean isNSContext() {
- return (null != impl) ? impl.isNSContext() : this.openGLMode == GLBackendType.NSOPENGL;
+ protected boolean isNSContext() {
+ return (null != impl) ? impl.isNSContext() : this.openGLMode == GLBackendType.NSOPENGL;
}
public CGLExt getCGLExt() {
@@ -161,6 +162,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return _cglExt;
}
+ @Override
public final ProcAddressTable getPlatformExtProcAddressTable() {
return getCGLExtProcAddressTable();
}
@@ -169,10 +171,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return cglExtProcAddressTable;
}
+ @Override
protected Map<String, String> getFunctionNameMap() { return null; }
+ @Override
protected Map<String, String> getExtensionNameMap() { return null; }
+ @Override
protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
if(!isGLProfileSupported(ctp, major, minor)) {
if(DEBUG) {
@@ -200,11 +205,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return ctx;
}
+ @Override
protected void destroyContextARBImpl(long _context) {
impl.release(_context);
impl.destroy(_context);
}
+ @Override
public final boolean isGLReadDrawableAvailable() {
return false;
}
@@ -219,7 +226,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
throw new GLException("GLContextShareSet returned a NULL OpenGL context");
}
}
-
+
MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
GLCapabilitiesImmutable capabilitiesChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities();
if (capabilitiesChosen.getPbufferFloatingPointBuffers() && !isTigerOrLater) {
@@ -229,40 +236,45 @@ public abstract class MacOSXCGLContext extends GLContextImpl
if(glp.isGLES1() || glp.isGLES2() || glp.isGL4() || glp.isGL3() && !isLionOrLater) {
throw new GLException("OpenGL profile not supported on MacOSX "+Platform.getOSVersionNumber()+": "+glp);
}
-
+
if (DEBUG) {
System.err.println("Share context is " + toHexString(share) + " for " + this);
}
- return share;
+ return share;
}
-
+
+ @Override
protected boolean createImpl(GLContextImpl shareWith) throws GLException {
long share = createImplPreset(shareWith);
contextHandle = createContextARB(share, true);
return 0 != contextHandle;
}
-
+
+ @Override
protected void makeCurrentImpl() throws GLException {
if (getOpenGLMode() != ((MacOSXCGLDrawable)drawable).getOpenGLMode()) {
setOpenGLMode(((MacOSXCGLDrawable)drawable).getOpenGLMode());
}
if (!impl.makeCurrent(contextHandle)) {
throw new GLException("Error making Context current: "+this);
- }
+ }
}
-
+
+ @Override
protected void releaseImpl() throws GLException {
if (!impl.release(contextHandle)) {
throw new GLException("Error releasing OpenGL Context: "+this);
}
}
+ @Override
protected void destroyImpl() throws GLException {
if(!impl.destroy(contextHandle)) {
throw new GLException("Error destroying OpenGL Context: "+this);
}
}
+ @Override
protected void copyImpl(GLContext source, int mask) throws GLException {
if( isNSContext() != ((MacOSXCGLContext)source).isNSContext() ) {
throw new GLException("Source/Destination OpenGL Context tyoe mismatch: source "+source+", dest: "+this);
@@ -275,7 +287,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
protected void swapBuffers() {
// single-buffer is already filtered out @ GLDrawableImpl#swapBuffers()
if(!impl.swapBuffers()) {
- throw new GLException("Error swapping buffers: "+this);
+ throw new GLException("Error swapping buffers: "+this);
}
}
@@ -284,11 +296,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return impl.setSwapInterval(interval);
}
+ @Override
public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) {
// FIXME: apparently the Apple extension doesn't require a custom memory allocator
throw new GLException("Not yet implemented");
}
+ @Override
protected final void updateGLXProcAddressTable() {
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
@@ -316,11 +330,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
}
}
-
+
+ @Override
protected final StringBuilder getPlatformExtensionsStringImpl() {
return new StringBuilder();
}
-
+
+ @Override
public boolean isExtensionAvailable(String glExtensionName) {
if (glExtensionName.equals("GL_ARB_pbuffer") ||
glExtensionName.equals("GL_ARB_pixel_format")) {
@@ -328,7 +344,8 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
return super.isExtensionAvailable(glExtensionName);
}
-
+
+ @Override
public int getOffscreenContextPixelDataType() {
throw new GLException("Should not call this");
}
@@ -337,18 +354,21 @@ public abstract class MacOSXCGLContext extends GLContextImpl
throw new GLException("Should not call this");
}
+ @Override
public boolean offscreenImageNeedsVerticalFlip() {
throw new GLException("Should not call this");
}
+ @Override
public void bindPbufferToTexture() {
throw new GLException("Should not call this");
}
-
+
+ @Override
public void releasePbufferFromTexture() {
throw new GLException("Should not call this");
}
-
+
// Support for "mode switching" as described in MacOSXCGLDrawable
public void setOpenGLMode(GLBackendType mode) {
if (mode == openGLMode) {
@@ -364,10 +384,10 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
initOpenGLImpl(mode);
openGLMode = mode;
- haveSetOpenGLMode = true;
+ haveSetOpenGLMode = true;
}
public final GLBackendType getOpenGLMode() { return openGLMode; }
-
+
protected void initOpenGLImpl(GLBackendType backend) {
switch (backend) {
case NSOPENGL:
@@ -379,8 +399,9 @@ public abstract class MacOSXCGLContext extends GLContextImpl
default:
throw new InternalError("Illegal implementation mode " + backend);
}
- }
-
+ }
+
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
@@ -391,22 +412,24 @@ public abstract class MacOSXCGLContext extends GLContextImpl
sb.append("] ");
return sb.toString();
}
-
+
// NSOpenGLContext-based implementation
class NSOpenGLImpl implements GLBackendImpl {
long nsOpenGLLayer = 0;
long nsOpenGLLayerPFmt = 0;
float screenVSyncTimeout; // microSec
int vsyncTimeout; // microSec - for nsOpenGLLayer mode
-
+
+ @Override
public boolean isNSContext() { return true; }
- public long create(long share, int ctp, int major, int minor) {
+ @Override
+ public long create(long share, int ctp, int major, int minor) {
long ctx = 0;
final MacOSXCGLDrawable drawable = (MacOSXCGLDrawable) MacOSXCGLContext.this.drawable;
final NativeSurface surface = drawable.getNativeSurface();
final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) surface.getGraphicsConfiguration();
- final OffscreenLayerSurface backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(surface, true);
+ final OffscreenLayerSurface backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(surface, true);
final GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
long pixelFormat = MacOSXCGLGraphicsConfiguration.GLCapabilities2NSPixelFormat(chosenCaps, ctp, major, minor);
if (pixelFormat == 0) {
@@ -417,7 +440,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
config.setChosenPixelFormat(pixelFormat);
int sRefreshRate = CGL.getScreenRefreshRate(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getIndex());
- screenVSyncTimeout = 1000000f / (float)sRefreshRate;
+ screenVSyncTimeout = 1000000f / sRefreshRate;
if(DEBUG) {
System.err.println("NS create OSX>=lion "+isLionOrLater);
System.err.println("NS create backendType: "+drawable.getOpenGLMode());
@@ -444,7 +467,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
return 0;
}
-
+
if (!chosenCaps.isPBuffer() && !chosenCaps.isBackgroundOpaque()) {
// Set the context opacity
CGL.setContextOpacity(ctx, 0);
@@ -456,7 +479,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
GLCapabilitiesImmutable fixedCaps = MacOSXCGLGraphicsConfiguration.NSPixelFormat2GLCapabilities(chosenCaps.getGLProfile(), pixelFormat);
fixedCaps = GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(fixedCaps, chosenCaps.isBackgroundOpaque());
- config.setChosenCapabilities(fixedCaps);
+ config.setChosenCapabilities(fixedCaps);
if(DEBUG) {
System.err.println("NS create fixedCaps: "+fixedCaps);
}
@@ -466,7 +489,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
//
// handled layered surface
- //
+ //
if(null != backingLayerHost) {
nsOpenGLLayerPFmt = pixelFormat;
pixelFormat = 0;
@@ -477,8 +500,8 @@ public abstract class MacOSXCGLContext extends GLContextImpl
texHeight = osxPDrawable.getTextureHeight();
} else {
texWidth = drawable.getWidth();
- texHeight = drawable.getHeight();
- }
+ texHeight = drawable.getHeight();
+ }
nsOpenGLLayer = CGL.createNSOpenGLLayer(ctx, nsOpenGLLayerPFmt, drawable.getHandle(), fixedCaps.isBackgroundOpaque(), texWidth, texHeight);
if(0>=texWidth || 0>=texHeight || !drawable.isRealized()) {
throw new GLException("Drawable not realized yet or invalid texture size, texSize "+texWidth+"x"+texHeight+", "+drawable);
@@ -494,9 +517,10 @@ public abstract class MacOSXCGLContext extends GLContextImpl
CGL.deletePixelFormat(pixelFormat);
}
}
- return ctx;
+ return ctx;
}
-
+
+ @Override
public boolean destroy(long ctx) {
if(0 != nsOpenGLLayer) {
final NativeSurface surface = drawable.getNativeSurface();
@@ -516,11 +540,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return CGL.deleteContext(ctx, true);
}
+ @Override
public boolean copyImpl(long src, int mask) {
CGL.copyContext(contextHandle, src, mask);
return true;
}
-
+
+ @Override
public boolean makeCurrent(long ctx) {
final long cglCtx = CGL.getCGLContext(ctx);
if(0 == cglCtx) {
@@ -535,13 +561,14 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return false;
}
+ @Override
public boolean release(long ctx) {
try {
gl.glFlush(); // w/o glFlush()/glFinish() OSX < 10.7 (NVidia driver) may freeze
} catch (GLException gle) {
if(DEBUG) {
System.err.println("MacOSXCGLContext.NSOpenGLImpl.release: INFO: glFlush() catched exception:");
- gle.printStackTrace();
+ gle.printStackTrace();
}
}
final boolean res = CGL.clearCurrentContext(ctx);
@@ -552,10 +579,11 @@ public abstract class MacOSXCGLContext extends GLContextImpl
final int err = CGL.CGLUnlockContext(cglCtx);
if(DEBUG && CGL.kCGLNoError != err) {
System.err.println("CGL: Could not unlock context: err 0x"+Integer.toHexString(err)+": "+this);
- }
+ }
return res && CGL.kCGLNoError == err;
}
+ @Override
public boolean setSwapInterval(int interval) {
if(0 != nsOpenGLLayer) {
CGL.setNSOpenGLLayerSwapInterval(nsOpenGLLayer, interval);
@@ -565,11 +593,12 @@ public abstract class MacOSXCGLContext extends GLContextImpl
CGL.setSwapInterval(contextHandle, interval);
return true;
}
-
+
+ @Override
public boolean swapBuffers() {
if( 0 != nsOpenGLLayer ) {
- // If v-sync is disabled, frames will be drawn as quickly as possible
- // w/o delay but in sync w/ CALayer. Otherwise wait until next swap interval (v-sync).
+ // If v-sync is disabled, frames will be drawn as quickly as possible
+ // w/o delay but in sync w/ CALayer. Otherwise wait until next swap interval (v-sync).
CGL.waitUntilNSOpenGLLayerIsReady(nsOpenGLLayer, vsyncTimeout);
}
if(CGL.flushBuffer(contextHandle)) {
@@ -584,8 +613,10 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
class CGLImpl implements GLBackendImpl {
+ @Override
public boolean isNSContext() { return false; }
-
+
+ @Override
public long create(long share, int ctp, int major, int minor) {
long ctx = 0;
MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
@@ -595,7 +626,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
throw new GLException("Unable to allocate pixel format with requested GLCapabilities");
}
config.setChosenPixelFormat(pixelFormat);
- try {
+ try {
// Create new context
PointerBuffer ctxPB = PointerBuffer.allocateDirect(1);
if (DEBUG) {
@@ -617,23 +648,26 @@ public abstract class MacOSXCGLContext extends GLContextImpl
if(DEBUG) {
GLCapabilitiesImmutable caps0 = MacOSXCGLGraphicsConfiguration.CGLPixelFormat2GLCapabilities(pixelFormat);
System.err.println("NS created: "+caps0);
- }
+ }
}
} finally {
- CGL.CGLDestroyPixelFormat(pixelFormat);
+ CGL.CGLDestroyPixelFormat(pixelFormat);
}
return ctx;
}
-
+
+ @Override
public boolean destroy(long ctx) {
return CGL.CGLDestroyContext(ctx) == CGL.kCGLNoError;
}
+ @Override
public boolean copyImpl(long src, int mask) {
CGL.CGLCopyContext(src, contextHandle, mask);
return true;
}
-
+
+ @Override
public boolean makeCurrent(long ctx) {
int err = CGL.CGLLockContext(ctx);
if(CGL.kCGLNoError == err) {
@@ -649,13 +683,14 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return false;
}
+ @Override
public boolean release(long ctx) {
try {
gl.glFlush(); // w/o glFlush()/glFinish() OSX < 10.7 (NVidia driver) may freeze
} catch (GLException gle) {
if(DEBUG) {
System.err.println("MacOSXCGLContext.CGLImpl.release: INFO: glFlush() catched exception:");
- gle.printStackTrace();
+ gle.printStackTrace();
}
}
int err = CGL.CGLSetCurrentContext(0);
@@ -668,14 +703,16 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
return CGL.kCGLNoError == err && CGL.kCGLNoError == err2;
}
-
+
+ @Override
public boolean setSwapInterval(int interval) {
int[] lval = new int[] { interval } ;
CGL.CGLSetParameter(contextHandle, CGL.kCGLCPSwapInterval, lval, 0);
return true;
- }
+ }
+ @Override
public boolean swapBuffers() {
return CGL.kCGLNoError == CGL.CGLFlushDrawable(contextHandle);
- }
- }
+ }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java
index 949963fa0..7b13ce22e 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -40,24 +40,26 @@
package jogamp.opengl.macosx.cgl;
import javax.media.opengl.*;
-import jogamp.opengl.*;
public class MacOSXOffscreenCGLContext extends MacOSXPbufferCGLContext
-{
+{
public MacOSXOffscreenCGLContext(MacOSXPbufferCGLDrawable drawable,
GLContext shareWith) {
super(drawable, shareWith);
}
-
+
+ @Override
public int getOffscreenContextPixelDataType() {
GL gl = getGL();
return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1;
}
+ @Override
public int getOffscreenContextReadBuffer() {
return GL.GL_FRONT;
}
+ @Override
public boolean offscreenImageNeedsVerticalFlip() {
return true;
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
index 9e051311c..e344fd461 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -54,9 +54,9 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
@Override
protected void makeCurrentImpl() throws GLException {
super.makeCurrentImpl();
- drawableUpdatedNotify();
+ drawableUpdatedNotify();
}
-
+
@Override
protected void drawableUpdatedNotify() throws GLException {
final int w = drawable.getWidth();
@@ -72,12 +72,12 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
CGL.updateContext(contextHandle);
}
}
-
+
@Override
protected boolean createImpl(GLContextImpl sharedWith) {
boolean res = super.createImpl(sharedWith);
- lastWidth = -1;
- lastHeight = -1;
+ lastWidth = -1;
+ lastHeight = -1;
if(res && isNSContext()) {
if(0 != updateHandle) {
throw new InternalError("XXX1");
@@ -96,9 +96,9 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
CGL.updateContextUnregister(updateHandle);
updateHandle = 0;
}
- super.destroyImpl();
+ super.destroyImpl();
}
-
+
private long updateHandle = 0;
private int lastWidth, lastHeight;
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java
index 7ba7d2d5a..88886ddd2 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -35,7 +35,6 @@ package jogamp.opengl.macosx.cgl;
import javax.media.opengl.GL;
import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
import javax.media.opengl.GLPbuffer;
import jogamp.opengl.GLContextImpl;
@@ -50,6 +49,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
super(drawable, shareWith);
}
+ @Override
public void bindPbufferToTexture() {
GL gl = getGL();
gl.glBindTexture(((MacOSXPbufferCGLDrawable)drawable).getTextureTarget(), texture);
@@ -59,17 +59,19 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
CGL.setContextTextureImageToPBuffer(contextHandle, drawable.getHandle(), GL.GL_FRONT);
}
+ @Override
public void releasePbufferFromTexture() {
}
+ @Override
protected boolean createImpl(GLContextImpl shareWith) {
boolean res = super.createImpl(shareWith);
- if(res) {
+ if(res) {
// Initialize render-to-texture support if requested
final GL gl = getGL();
final MacOSXPbufferCGLDrawable osxPDrawable = (MacOSXPbufferCGLDrawable)drawable;
final int textureTarget = osxPDrawable.getTextureTarget();
-
+
int[] tmp = new int[1];
gl.glGenTextures(1, tmp, 0);
texture = tmp[0];
@@ -78,13 +80,14 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE);
gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE);
- gl.glTexImage2D(textureTarget, 0, GL.GL_RGB, osxPDrawable.getTextureWidth(), osxPDrawable.getTextureHeight(),
+ gl.glTexImage2D(textureTarget, 0, GL.GL_RGB, osxPDrawable.getTextureWidth(), osxPDrawable.getTextureHeight(),
0, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, null);
gl.glCopyTexSubImage2D(textureTarget, 0, 0, 0, 0, 0, drawable.getWidth(), drawable.getHeight());
}
return res;
}
+ @Override
public int getFloatingPointMode() {
return GLPbuffer.APPLE_FLOAT;
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLContext.java
index 68b26b30d..51341a098 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLContext.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -48,15 +48,18 @@ public class WindowsBitmapWGLContext extends WindowsWGLContext {
super(drawable, shareWith);
}
+ @Override
public int getOffscreenContextPixelDataType() {
return GL.GL_UNSIGNED_BYTE;
}
-
+
+ @Override
public int getOffscreenContextReadBuffer() {
// On Windows these contexts are always single-buffered
return GL.GL_FRONT;
}
+ @Override
public boolean offscreenImageNeedsVerticalFlip() {
// We can take care of this in the DIB creation (see below)
return false;
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLContext.java
index a06ab8f0e..aef55efc6 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,26 +28,22 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
package jogamp.opengl.windows.wgl;
-import java.util.*;
-
-import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import jogamp.opengl.*;
public class WindowsOnscreenWGLContext extends WindowsWGLContext {
public WindowsOnscreenWGLContext(WindowsOnscreenWGLDrawable drawable,
GLContext shareWith) {
super(drawable, shareWith);
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLContext.java
index 0f610495d..a11d6e78e 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLContext.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -57,6 +57,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
super(drawable, shareWith);
}
+ @Override
public void bindPbufferToTexture() {
if (!rtt) {
throw new GLException("Shouldn't try to bind a pbuffer to a texture if render-to-texture hasn't been " +
@@ -75,6 +76,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
// we perform a glCopyTexImage2D in swapBuffers().
}
+ @Override
public void releasePbufferFromTexture() {
if (!rtt) {
throw new GLException("Shouldn't try to bind a pbuffer to a texture if render-to-texture hasn't been " +
@@ -88,6 +90,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
}
}
+ @Override
protected boolean createImpl(GLContextImpl shareWith) {
boolean res = super.createImpl(shareWith);
if(res) {
@@ -118,7 +121,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
if (DEBUG) {
System.err.println(" Using render-to-texture-rectangle");
}
- textureTarget = GL2.GL_TEXTURE_RECTANGLE_ARB;
+ textureTarget = GL2GL3.GL_TEXTURE_RECTANGLE_ARB;
} else {
if (DEBUG) {
System.err.println(" Using vanilla render-to-texture");
@@ -140,6 +143,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
return res;
}
+ @Override
public int getFloatingPointMode() {
return ((WindowsPbufferWGLDrawable)drawable).getFloatingPointMode();
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
index 217d88f3c..f143c158b 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -96,10 +96,11 @@ public class WindowsWGLContext extends GLContextImpl {
// no inner state _wglExt=null;
wglExtProcAddressTable=null;
hasSwapIntervalSGI = 0;
- hasSwapGroupNV = 0;
- super.resetStates();
+ hasSwapGroupNV = 0;
+ super.resetStates();
}
-
+
+ @Override
public Object getPlatformGLExtensions() {
return getWGLExt();
}
@@ -114,6 +115,7 @@ public class WindowsWGLContext extends GLContextImpl {
return _wglExt;
}
+ @Override
public final boolean isGLReadDrawableAvailable() {
if(!wglGLReadDrawableAvailableSet && null != getWGLExtProcAddressTable()) {
WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl();
@@ -159,6 +161,7 @@ public class WindowsWGLContext extends GLContextImpl {
return ok;
}
+ @Override
public final ProcAddressTable getPlatformExtProcAddressTable() {
return getWGLExtProcAddressTable();
}
@@ -167,15 +170,19 @@ public class WindowsWGLContext extends GLContextImpl {
return wglExtProcAddressTable;
}
+ @Override
protected Map<String, String> getFunctionNameMap() { return functionNameMap; }
+ @Override
protected Map<String, String> getExtensionNameMap() { return extensionNameMap; }
+ @Override
protected void destroyContextARBImpl(long context) {
WGL.wglMakeCurrent(0, 0);
WGL.wglDeleteContext(context);
}
+ @Override
protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
if( null == getWGLExtProcAddressTable()) {
updateGLXProcAddressTable();
@@ -213,8 +220,8 @@ public class WindowsWGLContext extends GLContextImpl {
attribs[idx_profile+1] = WGLExt.WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
} else {
attribs[idx_profile+1] = WGLExt.WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
- }
- }
+ }
+ }
if ( major >= 3 ) {
if( !ctBwdCompat && ctFwdCompat ) {
@@ -255,6 +262,7 @@ public class WindowsWGLContext extends GLContextImpl {
* Creates and initializes an appropriate OpenGL context. Should only be
* called by {@link #makeCurrentImpl()}.
*/
+ @Override
protected boolean createImpl(GLContextImpl shareWith) {
AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration();
AbstractGraphicsDevice device = config.getScreen().getDevice();
@@ -315,11 +323,11 @@ public class WindowsWGLContext extends GLContextImpl {
}
} else if (DEBUG) {
System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+share+
- ", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable);
+ ", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable);
}
}
}
-
+
if(0!=contextHandle) {
share = 0; // mark as shared thx to the ARB create method
if(0!=temp_ctx) {
@@ -347,7 +355,7 @@ public class WindowsWGLContext extends GLContextImpl {
throw new GLException("Error making old context current: 0x" + toHexString(contextHandle) + ", werr: " + GDI.GetLastError());
}
if(0!=share) {
- // Only utilize the classic GDI 'wglShareLists' shared context method
+ // Only utilize the classic GDI 'wglShareLists' shared context method
// for traditional non ARB context.
if (!WGL.wglShareLists(share, contextHandle)) {
throw new GLException("wglShareLists(" + toHexString(share) +
@@ -361,7 +369,8 @@ public class WindowsWGLContext extends GLContextImpl {
return true;
}
-
+
+ @Override
protected void makeCurrentImpl() throws GLException {
if (WGL.wglGetCurrentContext() != contextHandle) {
if (!wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
@@ -370,12 +379,14 @@ public class WindowsWGLContext extends GLContextImpl {
}
}
+ @Override
protected void releaseImpl() throws GLException {
if (!wglMakeContextCurrent(0, 0, 0)) {
throw new GLException("Error freeing OpenGL context, werr: " + GDI.GetLastError());
}
}
+ @Override
protected void destroyImpl() throws GLException {
WGL.wglMakeCurrent(0, 0);
if (!WGL.wglDeleteContext(contextHandle)) {
@@ -383,12 +394,14 @@ public class WindowsWGLContext extends GLContextImpl {
}
}
+ @Override
protected void copyImpl(GLContext source, int mask) throws GLException {
if (!WGL.wglCopyContext(source.getHandle(), getHandle(), mask)) {
throw new GLException("wglCopyContext failed");
}
}
+ @Override
protected final void updateGLXProcAddressTable() {
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
@@ -421,10 +434,11 @@ public class WindowsWGLContext extends GLContextImpl {
}
}
}
-
+
+ @Override
protected final StringBuilder getPlatformExtensionsStringImpl() {
StringBuilder sb = new StringBuilder();
-
+
if (!wglGetExtensionsStringEXTInitialized) {
wglGetExtensionsStringEXTAvailable = (WGL.wglGetProcAddress("wglGetExtensionsStringEXT") != 0);
wglGetExtensionsStringEXTInitialized = true;
@@ -434,7 +448,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
return sb;
}
-
+
@Override
protected boolean setSwapIntervalImpl(int interval) {
WGLExt wglExt = getWGLExt();
@@ -450,7 +464,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
return false;
}
-
+
private final int initSwapGroupImpl(WGLExt wglExt) {
if(0==hasSwapGroupNV) {
try {
@@ -462,7 +476,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
return hasSwapGroupNV;
}
-
+
@Override
protected final boolean queryMaxSwapGroupsImpl(int[] maxGroups, int maxGroups_offset,
int[] maxBarriers, int maxBarriers_offset) {
@@ -471,7 +485,7 @@ public class WindowsWGLContext extends GLContextImpl {
if (initSwapGroupImpl(wglExt)>0) {
final NativeSurface ns = drawable.getNativeSurface();
try {
- if( wglExt.wglQueryMaxSwapGroupsNV(ns.getDisplayHandle(),
+ if( wglExt.wglQueryMaxSwapGroupsNV(ns.getDisplayHandle(),
maxGroups, maxGroups_offset,
maxBarriers, maxBarriers_offset) ) {
res = true;
@@ -480,7 +494,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
return res;
}
-
+
@Override
protected final boolean joinSwapGroupImpl(int group) {
boolean res = false;
@@ -495,7 +509,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
return res;
}
-
+
@Override
protected final boolean bindSwapBarrierImpl(int group, int barrier) {
boolean res = false;
@@ -507,13 +521,15 @@ public class WindowsWGLContext extends GLContextImpl {
}
} catch (Throwable t) { hasSwapGroupNV=-1; }
}
- return res;
+ return res;
}
-
+
+ @Override
public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) {
return getWGLExt().wglAllocateMemoryNV(arg0, arg1, arg2, arg3);
}
+ @Override
public int getOffscreenContextPixelDataType() {
throw new GLException("Should not call this");
}
@@ -522,14 +538,17 @@ public class WindowsWGLContext extends GLContextImpl {
throw new GLException("Should not call this");
}
+ @Override
public boolean offscreenImageNeedsVerticalFlip() {
throw new GLException("Should not call this");
}
+ @Override
public void bindPbufferToTexture() {
throw new GLException("Should not call this");
}
+ @Override
public void releasePbufferFromTexture() {
throw new GLException("Should not call this");
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index 2fd8cbcd9..918bf8643 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -91,7 +91,7 @@ public abstract class X11GLXContext extends GLContextImpl {
GLContext shareWith) {
super(drawable, shareWith);
}
-
+
@Override
protected void resetStates() {
// no inner state _glXExt=null;
@@ -102,6 +102,7 @@ public abstract class X11GLXContext extends GLContextImpl {
super.resetStates();
}
+ @Override
public final ProcAddressTable getPlatformExtProcAddressTable() {
return getGLXExtProcAddressTable();
}
@@ -110,6 +111,7 @@ public abstract class X11GLXContext extends GLContextImpl {
return glXExtProcAddressTable;
}
+ @Override
public Object getPlatformGLExtensions() {
return getGLXExt();
}
@@ -121,14 +123,17 @@ public abstract class X11GLXContext extends GLContextImpl {
return _glXExt;
}
+ @Override
protected Map<String, String> getFunctionNameMap() { return functionNameMap; }
+ @Override
protected Map<String, String> getExtensionNameMap() { return extensionNameMap; }
protected final boolean isGLXVersionGreaterEqualOneThree() {
- return ((X11GLXDrawableFactory)drawable.getFactoryImpl()).isGLXVersionGreaterEqualOneThree(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice());
+ return ((X11GLXDrawableFactory)drawable.getFactoryImpl()).isGLXVersionGreaterEqualOneThree(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice());
}
-
+
+ @Override
public final boolean isGLReadDrawableAvailable() {
return isGLXVersionGreaterEqualOneThree();
}
@@ -158,6 +163,7 @@ public abstract class X11GLXContext extends GLContextImpl {
return res;
}
+ @Override
protected void destroyContextARBImpl(long ctx) {
X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration();
long display = config.getScreen().getDevice().getHandle();
@@ -178,7 +184,8 @@ public abstract class X11GLXContext extends GLContextImpl {
/* 8 */ 0, 0,
/* 10 */ 0
};
-
+
+ @Override
protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
updateGLXProcAddressTable();
GLXExt _glXExt = getGLXExt();
@@ -197,15 +204,15 @@ public abstract class X11GLXContext extends GLContextImpl {
IntBuffer attribs = Buffers.newDirectIntBuffer(ctx_arb_attribs_rom);
attribs.put(ctx_arb_attribs_idx_major + 1, major);
attribs.put(ctx_arb_attribs_idx_minor + 1, minor);
-
+
if ( major > 3 || major == 3 && minor >= 2 ) {
attribs.put(ctx_arb_attribs_idx_profile + 0, GLX.GLX_CONTEXT_PROFILE_MASK_ARB);
if( ctBwdCompat ) {
attribs.put(ctx_arb_attribs_idx_profile + 1, GLX.GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB);
} else {
attribs.put(ctx_arb_attribs_idx_profile + 1, GLX.GLX_CONTEXT_CORE_PROFILE_BIT_ARB);
- }
- }
+ }
+ }
if ( major >= 3 ) {
int flags = attribs.get(ctx_arb_attribs_idx_flags + 1);
@@ -253,6 +260,7 @@ public abstract class X11GLXContext extends GLContextImpl {
return ctx;
}
+ @Override
protected boolean createImpl(GLContextImpl shareWith) {
// covers the whole context creation loop incl createContextARBImpl and destroyContextARBImpl
X11Util.setX11ErrorHandler(true, DEBUG ? false : true);
@@ -340,7 +348,7 @@ public abstract class X11GLXContext extends GLContextImpl {
createContextARBTried=true;
if (DEBUG) {
if(0!=contextHandle) {
- System.err.println(getThreadName() + ": createContextImpl: OK (ARB, initial) share "+share);
+ System.err.println(getThreadName() + ": createContextImpl: OK (ARB, initial) share "+share);
} else {
System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - creation failed - share "+share);
}
@@ -388,6 +396,7 @@ public abstract class X11GLXContext extends GLContextImpl {
return true;
}
+ @Override
protected void makeCurrentImpl() throws GLException {
long dpy = drawable.getNativeSurface().getDisplayHandle();
@@ -403,6 +412,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
}
+ @Override
protected void releaseImpl() throws GLException {
long display = drawable.getNativeSurface().getDisplayHandle();
X11Util.setX11ErrorHandler(true, DEBUG ? false : true);
@@ -415,10 +425,12 @@ public abstract class X11GLXContext extends GLContextImpl {
}
}
+ @Override
protected void destroyImpl() throws GLException {
GLX.glXDestroyContext(drawable.getNativeSurface().getDisplayHandle(), contextHandle);
}
+ @Override
protected void copyImpl(GLContext source, int mask) throws GLException {
long dst = getHandle();
long src = source.getHandle();
@@ -430,6 +442,7 @@ public abstract class X11GLXContext extends GLContextImpl {
// Should check for X errors and raise GLException
}
+ @Override
protected final void updateGLXProcAddressTable() {
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
@@ -458,11 +471,12 @@ public abstract class X11GLXContext extends GLContextImpl {
}
}
+ @Override
protected final StringBuilder getPlatformExtensionsStringImpl() {
StringBuilder sb = new StringBuilder();
if (DEBUG) {
System.err.println("GLX Version client version "+ GLXUtil.getClientVersionNumber()+
- ", server: "+
+ ", server: "+
((X11GLXDrawableFactory)drawable.getFactoryImpl()).getGLXVersionNumber(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice()));
}
final NativeSurface ns = drawable.getNativeSurface();
@@ -492,6 +506,7 @@ public abstract class X11GLXContext extends GLContextImpl {
return sb;
}
+ @Override
public boolean isExtensionAvailable(String glExtensionName) {
if (glExtensionName.equals("GL_ARB_pbuffer") ||
glExtensionName.equals("GL_ARB_pixel_format")) {
@@ -532,7 +547,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
return hasSwapGroupNV;
}
-
+
@Override
protected final boolean queryMaxSwapGroupsImpl(int[] maxGroups, int maxGroups_offset,
int[] maxBarriers, int maxBarriers_offset) {
@@ -541,7 +556,7 @@ public abstract class X11GLXContext extends GLContextImpl {
if (initSwapGroupImpl(glXExt)>0) {
final NativeSurface ns = drawable.getNativeSurface();
try {
- if( glXExt.glXQueryMaxSwapGroupsNV(ns.getDisplayHandle(), ns.getScreenIndex(),
+ if( glXExt.glXQueryMaxSwapGroupsNV(ns.getDisplayHandle(), ns.getScreenIndex(),
maxGroups, maxGroups_offset,
maxBarriers, maxBarriers_offset) ) {
res = true;
@@ -550,7 +565,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
return res;
}
-
+
@Override
protected final boolean joinSwapGroupImpl(int group) {
boolean res = false;
@@ -565,7 +580,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
return res;
}
-
+
@Override
protected final boolean bindSwapBarrierImpl(int group, int barrier) {
boolean res = false;
@@ -577,7 +592,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
} catch (Throwable t) { hasSwapGroupNV=-1; }
}
- return res;
+ return res;
}
@Override
@@ -585,6 +600,7 @@ public abstract class X11GLXContext extends GLContextImpl {
return getGLXExt().glXAllocateMemoryNV(arg0, arg1, arg2, arg3);
}
+ @Override
public int getOffscreenContextPixelDataType() {
throw new GLException("Should not call this");
}
@@ -593,18 +609,22 @@ public abstract class X11GLXContext extends GLContextImpl {
throw new GLException("Should not call this");
}
+ @Override
public boolean offscreenImageNeedsVerticalFlip() {
throw new GLException("Should not call this");
}
+ @Override
public void bindPbufferToTexture() {
throw new GLException("Should not call this");
}
+ @Override
public void releasePbufferFromTexture() {
throw new GLException("Should not call this");
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXContext.java
index ce5d466d4..460dc10ca 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXContext.java
index 765a8207a..a34e050cd 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -47,17 +47,20 @@ public class X11PbufferGLXContext extends X11GLXContext {
super(drawable, shareWith);
}
+ @Override
public void bindPbufferToTexture() {
// FIXME: figure out how to implement this
throw new GLException("Not yet implemented");
}
+ @Override
public void releasePbufferFromTexture() {
// FIXME: figure out how to implement this
throw new GLException("Not yet implemented");
}
+ @Override
public int getFloatingPointMode() {
return ((X11PbufferGLXDrawable)drawable).getFloatingPointMode();
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXContext.java
index e19dfd1b3..96d0f18dc 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXContext.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -49,11 +49,13 @@ public class X11PixmapGLXContext extends X11GLXContext {
super(drawable, shareWith);
}
+ @Override
public int getOffscreenContextPixelDataType() {
GL gl = getGL();
return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1;
}
-
+
+ @Override
public int getOffscreenContextReadBuffer() {
GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)drawable.getNativeSurface().getGraphicsConfiguration().getChosenCapabilities();
if (caps.getDoubleBuffered()) {
@@ -62,6 +64,7 @@ public class X11PixmapGLXContext extends X11GLXContext {
return GL.GL_FRONT;
}
+ @Override
public boolean offscreenImageNeedsVerticalFlip() {
// There doesn't seem to be a way to do this in the construction
// of the Pixmap or GLXPixmap