diff options
Diffstat (limited to 'src/jogl/classes/javax/media')
24 files changed, 458 insertions, 452 deletions
diff --git a/src/jogl/classes/javax/media/opengl/DebugGL2.java b/src/jogl/classes/javax/media/opengl/DebugGL2.java index 3c064a18f..e0d24c4a1 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL2.java +++ b/src/jogl/classes/javax/media/opengl/DebugGL2.java @@ -15,7 +15,7 @@ package javax.media.opengl; * </p> */ public class DebugGL2 extends DebugGL4bc { - public DebugGL2(GL2 downstream) { + public DebugGL2(final GL2 downstream) { super((GL4bc)downstream); } } diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3.java b/src/jogl/classes/javax/media/opengl/DebugGL3.java index b490a63f4..678e800f6 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL3.java +++ b/src/jogl/classes/javax/media/opengl/DebugGL3.java @@ -15,7 +15,7 @@ package javax.media.opengl; * </p> */ public class DebugGL3 extends DebugGL4bc { - public DebugGL3(GL3 downstream) { + public DebugGL3(final GL3 downstream) { super((GL4bc)downstream); } } diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java b/src/jogl/classes/javax/media/opengl/DebugGL3bc.java index 1d42afbc6..2636e9428 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java +++ b/src/jogl/classes/javax/media/opengl/DebugGL3bc.java @@ -15,7 +15,7 @@ package javax.media.opengl; * </p> */ public class DebugGL3bc extends DebugGL4bc { - public DebugGL3bc(GL3bc downstream) { + public DebugGL3bc(final GL3bc downstream) { super((GL4bc)downstream); } } diff --git a/src/jogl/classes/javax/media/opengl/DebugGL4.java b/src/jogl/classes/javax/media/opengl/DebugGL4.java index 249d850a3..c4f8764cb 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL4.java +++ b/src/jogl/classes/javax/media/opengl/DebugGL4.java @@ -15,7 +15,7 @@ package javax.media.opengl; * </p> */ public class DebugGL4 extends DebugGL4bc { - public DebugGL4(GL4 downstream) { + public DebugGL4(final GL4 downstream) { super((GL4bc)downstream); } } diff --git a/src/jogl/classes/javax/media/opengl/DebugGLES2.java b/src/jogl/classes/javax/media/opengl/DebugGLES2.java index 6d666d82a..c4e06f347 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGLES2.java +++ b/src/jogl/classes/javax/media/opengl/DebugGLES2.java @@ -15,7 +15,7 @@ package javax.media.opengl; * </p> */ public class DebugGLES2 extends DebugGLES3 { - public DebugGLES2(GLES2 downstream) { + public DebugGLES2(final GLES2 downstream) { super((GLES3)downstream); } } diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java index 7e243471e..412af25e0 100644 --- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java +++ b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java @@ -41,9 +41,13 @@ package javax.media.opengl; import javax.media.nativewindow.NativeWindowException; + import java.util.List; + import javax.media.nativewindow.CapabilitiesImmutable; +import com.jogamp.common.util.PropertyAccess; + import jogamp.opengl.Debug; /** <P> The default implementation of the {@link @@ -89,7 +93,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { static { Debug.initSingleton(); - DEBUG = Debug.isPropertyDefined("jogl.debug.CapabilitiesChooser", true); + DEBUG = PropertyAccess.isPropertyDefined("jogl.debug.CapabilitiesChooser", true); } private final static int NO_SCORE = -9999999; @@ -142,7 +146,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { } // Create score array - int[] scores = new int[availnum]; + final int[] scores = new int[availnum]; for (int i = 0; i < scores.length; i++) { scores[i] = NO_SCORE; @@ -218,13 +222,13 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { boolean gotHW = false; int maxAbsoluteHWScore = 0; for (int i = 0; i < availnum; i++) { - int score = scores[i]; + final int score = scores[i]; if (score == NO_SCORE) { continue; } final GLCapabilitiesImmutable cur = (GLCapabilitiesImmutable) available.get(i); if (cur.getHardwareAccelerated()) { - int absScore = Math.abs(score); + final int absScore = Math.abs(score); if (!gotHW || (absScore > maxAbsoluteHWScore)) { gotHW = true; @@ -265,7 +269,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { int scoreClosestToZero = NO_SCORE; int chosenIndex = -1; for (int i = 0; i < availnum; i++) { - int score = scores[i]; + final int score = scores[i]; if (score == NO_SCORE) { continue; } @@ -289,7 +293,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { return chosenIndex; } - private static int sign(int score) { + private static int sign(final int score) { if (score < 0) { return -1; } diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/javax/media/opengl/GLCapabilities.java index 4dafe5262..0d65d35cb 100644 --- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java +++ b/src/jogl/classes/javax/media/opengl/GLCapabilities.java @@ -80,7 +80,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * @param glp GLProfile, or null for the default GLProfile * @throws GLException if no profile is given and no default profile is available for the default device. */ - public GLCapabilities(GLProfile glp) throws GLException { + public GLCapabilities(final GLProfile glp) throws GLException { glProfile = (null!=glp)?glp:GLProfile.getDefault(GLProfile.getDefaultDevice()); } @@ -93,7 +93,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil public Object clone() { try { return super.clone(); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw new GLException(e); } } @@ -103,7 +103,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * from <code>source</code> into this instance. * @return this instance */ - public GLCapabilities copyFrom(GLCapabilitiesImmutable source) { + public GLCapabilities copyFrom(final GLCapabilitiesImmutable source) { super.copyFrom(source); glProfile = source.getGLProfile(); isPBuffer = source.isPBuffer(); @@ -145,12 +145,12 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if(this == obj) { return true; } if(!(obj instanceof GLCapabilitiesImmutable)) { return false; } - GLCapabilitiesImmutable other = (GLCapabilitiesImmutable)obj; + final GLCapabilitiesImmutable other = (GLCapabilitiesImmutable)obj; boolean res = super.equals(obj) && other.getGLProfile()==glProfile && other.isPBuffer()==isPBuffer && @@ -176,7 +176,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil @Override public int compareTo(final CapabilitiesImmutable o) { if ( ! ( o instanceof GLCapabilitiesImmutable ) ) { - Class<?> c = (null != o) ? o.getClass() : null ; + final Class<?> c = (null != o) ? o.getClass() : null ; throw new ClassCastException("Not a GLCapabilitiesImmutable object, but " + c); } final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) o; @@ -235,7 +235,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } /** Sets the GL profile you desire */ - public void setGLProfile(GLProfile profile) { + public void setGLProfile(final GLProfile profile) { glProfile=profile; } @@ -256,7 +256,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * Requesting offscreen pbuffer mode disables the offscreen auto selection. * </p> */ - public void setPBuffer(boolean enable) { + public void setPBuffer(final boolean enable) { if(enable) { setOnscreen(false); } @@ -280,7 +280,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * Requesting offscreen FBO mode disables the offscreen auto selection. * </p> */ - public void setFBO(boolean enable) { + public void setFBO(final boolean enable) { if(enable) { setOnscreen(false); } @@ -293,7 +293,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } /** Enables or disables double buffering. */ - public void setDoubleBuffered(boolean enable) { + public void setDoubleBuffered(final boolean enable) { doubleBuffered = enable; } @@ -303,7 +303,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } /** Enables or disables stereo viewing. */ - public void setStereo(boolean enable) { + public void setStereo(final boolean enable) { stereo = enable; } @@ -313,7 +313,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } /** Enables or disables hardware acceleration. */ - public void setHardwareAccelerated(boolean enable) { + public void setHardwareAccelerated(final boolean enable) { hardwareAccelerated = enable; } @@ -323,7 +323,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } /** Sets the number of bits requested for the depth buffer. */ - public void setDepthBits(int depthBits) { + public void setDepthBits(final int depthBits) { this.depthBits = depthBits; } @@ -333,7 +333,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } /** Sets the number of bits requested for the stencil buffer. */ - public void setStencilBits(int stencilBits) { + public void setStencilBits(final int stencilBits) { this.stencilBits = stencilBits; } @@ -346,7 +346,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil red component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered. */ - public void setAccumRedBits(int accumRedBits) { + public void setAccumRedBits(final int accumRedBits) { this.accumRedBits = accumRedBits; } @@ -359,7 +359,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil green component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered. */ - public void setAccumGreenBits(int accumGreenBits) { + public void setAccumGreenBits(final int accumGreenBits) { this.accumGreenBits = accumGreenBits; } @@ -372,7 +372,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil blue component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered. */ - public void setAccumBlueBits(int accumBlueBits) { + public void setAccumBlueBits(final int accumBlueBits) { this.accumBlueBits = accumBlueBits; } @@ -385,7 +385,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered. */ - public void setAccumAlphaBits(int accumAlphaBits) { + public void setAccumAlphaBits(final int accumAlphaBits) { this.accumAlphaBits = accumAlphaBits; } @@ -393,7 +393,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * Sets the desired extension for full-scene antialiasing * (FSAA), default is {@link #DEFAULT_SAMPLE_EXTENSION}. */ - public void setSampleExtension(String se) { + public void setSampleExtension(final String se) { sampleExtension = se; } @@ -410,7 +410,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * If enabled this method also invokes {@link #setAlphaBits(int) setAlphaBits(1)} * if {@link #getAlphaBits()} == 0.<br> */ - public void setSampleBuffers(boolean enable) { + public void setSampleBuffers(final boolean enable) { sampleBuffers = enable; if(sampleBuffers && getAlphaBits()==0) { setAlphaBits(1); @@ -427,7 +427,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * to be allocated. Defaults to 2. * @see #getNumSamples() */ - public void setNumSamples(int numSamples) { + public void setNumSamples(final int numSamples) { this.numSamples = numSamples; } @@ -503,7 +503,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil object. */ @Override public String toString() { - StringBuilder msg = new StringBuilder(); + final StringBuilder msg = new StringBuilder(); msg.append("GLCaps["); toString(msg); msg.append("]"); diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 9a4311772..16399799f 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -227,7 +227,7 @@ public abstract class GLContext { /** * @param isInit true if called for class initialization, otherwise false (re-init or destruction). */ - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { if (DEBUG) { System.err.println(getThreadName() + ": GLContext.resetStates(isInit "+isInit+")"); // Thread.dumpStack(); @@ -277,7 +277,7 @@ public abstract class GLContext { * @param quirk the quirk to be tested, e.g. {@link GLRendererQuirks#NoDoubleBufferedPBuffer}. * @throws IllegalArgumentException if the quirk is out of range */ - public final boolean hasRendererQuirk(int quirk) throws IllegalArgumentException { + public final boolean hasRendererQuirk(final int quirk) throws IllegalArgumentException { return null != glRendererQuirks ? glRendererQuirks.exist(quirk) : false ; } @@ -460,7 +460,7 @@ public abstract class GLContext { * @throws GLException if no context is current */ public static GL getCurrentGL() throws GLException { - GLContext glc = getCurrent(); + final GLContext glc = getCurrent(); if(null==glc) { throw new GLException(getThreadName()+": No OpenGL context current on this thread"); } @@ -495,7 +495,7 @@ public abstract class GLContext { } /** Returns a String representation of the {@link #makeCurrent()} result. */ - public static final String makeCurrentResultToString(int res) { + public static final String makeCurrentResultToString(final int res) { switch(res) { case CONTEXT_NOT_CURRENT: return "CONTEXT_NOT_CURRENT"; case CONTEXT_CURRENT: return "CONTEXT_CURRENT"; @@ -509,7 +509,7 @@ public abstract class GLContext { * and has no other side-effects. For use by third parties adding * new GLContext implementations; not for use by end users. */ - protected static void setCurrent(GLContext cur) { + protected static void setCurrent(final GLContext cur) { if( TRACE_SWITCH ) { if(null == cur) { System.err.println(getThreadName()+": GLContext.ContextSwitch: - setCurrent() - NULL"); @@ -570,7 +570,7 @@ public abstract class GLContext { /** * Returns the attached user object for the given name to this GLContext. */ - public final Object getAttachedObject(String name) { + public final Object getAttachedObject(final String name) { return attachedObjects.get(name); } @@ -578,11 +578,11 @@ public abstract class GLContext { * Sets the attached user object for the given name to this GLContext. * Returns the previously set object or null. */ - public final Object attachObject(String name, Object obj) { + public final Object attachObject(final String name, final Object obj) { return attachedObjects.put(name, obj); } - public final Object detachObject(String name) { + public final Object detachObject(final String name) { return attachedObjects.remove(name); } @@ -591,7 +591,7 @@ public abstract class GLContext { */ @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); this.append(sb); @@ -599,7 +599,7 @@ public abstract class GLContext { return sb.toString(); } - public final StringBuilder append(StringBuilder sb) { + public final StringBuilder append(final StringBuilder sb) { sb.append("Version ").append(getGLVersion()).append(" [GL ").append(getGLVersionNumber()).append(", vendor ").append(getGLVendorVersionNumber()); sb.append("], options 0x"); sb.append(Integer.toHexString(ctxOptions)); @@ -816,7 +816,7 @@ public abstract class GLContext { return "#version " + ctxGLSLVersion.getMajor() + ( minor < 10 ? "0"+minor : minor ) + esSuffix + "\n" ; } - protected static final VersionNumber getStaticGLSLVersionNumber(int glMajorVersion, int glMinorVersion, int ctxOptions) { + protected static final VersionNumber getStaticGLSLVersionNumber(final int glMajorVersion, final int glMinorVersion, final int ctxOptions) { if( 0 != ( CTX_PROFILE_ES & ctxOptions ) ) { if( 3 == glMajorVersion ) { return Version300; // ES 3.0 -> GLSL 3.00 @@ -938,14 +938,14 @@ public abstract class GLContext { final GL gl = getGL(); final int[] val = new int[] { 0 } ; try { - gl.glGetIntegerv(GL2GL3.GL_MAX_SAMPLES, val, 0); + gl.glGetIntegerv(GL2ES3.GL_MAX_SAMPLES, val, 0); final int glerr = gl.glGetError(); if(GL.GL_NO_ERROR == glerr) { return val[0]; } else if(DEBUG) { System.err.println("GLContext.getMaxRenderbufferSamples: GL_MAX_SAMPLES query GL Error 0x"+Integer.toHexString(glerr)); } - } catch (GLException gle) { gle.printStackTrace(); } + } catch (final GLException gle) { gle.printStackTrace(); } } return 0; } @@ -1188,7 +1188,7 @@ public abstract class GLContext { * * @throws GLException if the context is not current. */ - public final boolean setSwapInterval(int interval) throws GLException { + public final boolean setSwapInterval(final int interval) throws GLException { validateCurrent(); if(0<=interval) { if( !drawableRetargeted || !hasRendererQuirk(GLRendererQuirks.NoSetSwapIntervalPostRetarget) ) { @@ -1200,7 +1200,7 @@ public abstract class GLContext { } return false; } - protected boolean setSwapIntervalImpl(int interval) { + protected boolean setSwapIntervalImpl(final int interval) { return false; } /** Return the current swap interval. @@ -1225,27 +1225,27 @@ public abstract class GLContext { } } - public final boolean queryMaxSwapGroups(int[] maxGroups, int maxGroups_offset, - int[] maxBarriers, int maxBarriers_offset) { + public final boolean queryMaxSwapGroups(final int[] maxGroups, final int maxGroups_offset, + final int[] maxBarriers, final int maxBarriers_offset) { validateCurrent(); return queryMaxSwapGroupsImpl(maxGroups, maxGroups_offset, maxBarriers, maxBarriers_offset); } - protected boolean queryMaxSwapGroupsImpl(int[] maxGroups, int maxGroups_offset, - int[] maxBarriers, int maxBarriers_offset) { return false; } - public final boolean joinSwapGroup(int group) { + protected boolean queryMaxSwapGroupsImpl(final int[] maxGroups, final int maxGroups_offset, + final int[] maxBarriers, final int maxBarriers_offset) { return false; } + public final boolean joinSwapGroup(final int group) { validateCurrent(); return joinSwapGroupImpl(group); } - protected boolean joinSwapGroupImpl(int group) { /** nop per default .. **/ return false; } + protected boolean joinSwapGroupImpl(final int group) { /** nop per default .. **/ return false; } protected int currentSwapGroup = -1; // default: not set yet .. public int getSwapGroup() { return currentSwapGroup; } - public final boolean bindSwapBarrier(int group, int barrier) { + public final boolean bindSwapBarrier(final int group, final int barrier) { validateCurrent(); return bindSwapBarrierImpl(group, barrier); } - protected boolean bindSwapBarrierImpl(int group, int barrier) { /** nop per default .. **/ return false; } + protected boolean bindSwapBarrierImpl(final int group, final int barrier) { /** nop per default .. **/ return false; } /** * Return the framebuffer name bound to this context, @@ -1406,11 +1406,11 @@ public abstract class GLContext { /* 2.*/ { 0 }, /* 3.*/ { 0 } }; - public static final int getMaxMajor(int ctxProfile) { + public static final int getMaxMajor(final int ctxProfile) { return ( 0 != ( CTX_PROFILE_ES & ctxProfile ) ) ? ES_VERSIONS.length-1 : GL_VERSIONS.length-1; } - public static final int getMaxMinor(int ctxProfile, int major) { + public static final int getMaxMinor(final int ctxProfile, final int major) { if( 1>major ) { return -1; } @@ -1439,7 +1439,7 @@ public abstract class GLContext { * and {@link #decrementGLVersion(int, int[], int[])} until invalid. * </p> */ - public static final boolean isValidGLVersion(int ctxProfile, int major, int minor) { + public static final boolean isValidGLVersion(final int ctxProfile, final int major, final int minor) { if( 1>major || 0>minor ) { return false; } @@ -1455,7 +1455,7 @@ public abstract class GLContext { * Clip the given GL version to the maximum known valid version if exceeding. * @return true if clipped, i.e. given value exceeds maximum, otherwise false. */ - public static final boolean clipGLVersion(int ctxProfile, int major[], int minor[]) { + public static final boolean clipGLVersion(final int ctxProfile, final int major[], final int minor[]) { final int m = major[0]; final int n = minor[0]; @@ -1494,7 +1494,7 @@ public abstract class GLContext { * @param minor * @return */ - public static final boolean decrementGLVersion(int ctxProfile, int major[], int minor[]) { + public static final boolean decrementGLVersion(final int ctxProfile, final int major[], final int minor[]) { if( !clipGLVersion(ctxProfile, major, minor) ) { int m = major[0]; int n = minor[0] - 1; @@ -1520,13 +1520,13 @@ public abstract class GLContext { return true; } - protected static int composeBits(int a8, int b8, int c16) { + protected static int composeBits(final int a8, final int b8, final int c16) { return ( ( a8 & 0x000000FF ) << 24 ) | ( ( b8 & 0x000000FF ) << 16 ) | ( ( c16 & 0x0000FFFF ) ) ; } - private static void validateProfileBits(int bits, String argName) { + private static void validateProfileBits(final int bits, final String argName) { int num = 0; if( 0 != ( CTX_PROFILE_COMPAT & bits ) ) { num++; } if( 0 != ( CTX_PROFILE_CORE & bits ) ) { num++; } @@ -1557,13 +1557,13 @@ public abstract class GLContext { GLContextImpl.shutdownImpl(); // well .. } - protected static boolean getAvailableGLVersionsSet(AbstractGraphicsDevice device) { + protected static boolean getAvailableGLVersionsSet(final AbstractGraphicsDevice device) { synchronized ( deviceVersionsAvailableSet ) { return deviceVersionsAvailableSet.containsKey(device.getUniqueID()); } } - protected static void setAvailableGLVersionsSet(AbstractGraphicsDevice device) { + protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device) { synchronized ( deviceVersionsAvailableSet ) { final String devKey = device.getUniqueID(); if( null != deviceVersionsAvailableSet.put(devKey, devKey) ) { @@ -1580,7 +1580,7 @@ public abstract class GLContext { * Returns a unique String object using {@link String#intern()} for the given arguments, * which object reference itself can be used as a key. */ - protected static String getDeviceVersionAvailableKey(AbstractGraphicsDevice device, int major, int profile) { + protected static String getDeviceVersionAvailableKey(final AbstractGraphicsDevice device, final int major, final int profile) { final String r = device.getUniqueID() + "-" + toHexString(composeBits(major, profile, 0)); return r.intern(); } @@ -1597,8 +1597,8 @@ public abstract class GLContext { * * @see #createContextARBMapVersionsAvailable */ - protected static Integer mapAvailableGLVersion(AbstractGraphicsDevice device, - int reqMajor, int profile, int resMajor, int resMinor, int resCtp) + protected static Integer mapAvailableGLVersion(final AbstractGraphicsDevice device, + final int reqMajor, final int profile, final int resMajor, final int resMinor, int resCtp) { validateProfileBits(profile, "profile"); validateProfileBits(resCtp, "resCtp"); @@ -1624,7 +1624,7 @@ public abstract class GLContext { synchronized(deviceVersionAvailable) { final Set<String> keys = deviceVersionAvailable.keySet(); boolean needsSeparator = false; - for(Iterator<String> i = keys.iterator(); i.hasNext(); ) { + for(final Iterator<String> i = keys.iterator(); i.hasNext(); ) { if(needsSeparator) { sb.append(Platform.getNewline()); } @@ -1652,7 +1652,7 @@ public abstract class GLContext { * @param reqProfile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES} * @return the available GL version as encoded with {@link #composeBits(int, int, int), otherwise <code>null</code> */ - protected static Integer getAvailableGLVersion(AbstractGraphicsDevice device, int reqMajor, int reqProfile) { + protected static Integer getAvailableGLVersion(final AbstractGraphicsDevice device, final int reqMajor, final int reqProfile) { final String objectKey = getDeviceVersionAvailableKey(device, reqMajor, reqProfile); Integer val; synchronized(deviceVersionAvailable) { @@ -1668,8 +1668,8 @@ 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, - int[] major, int minor[], int ctp[]) { + protected static boolean getAvailableGLVersion(final AbstractGraphicsDevice device, final int reqMajor, final int reqProfile, + final int[] major, final int minor[], final int ctp[]) { final Integer valI = getAvailableGLVersion(device, reqMajor, reqProfile); if(null==valI) { @@ -1694,7 +1694,7 @@ public abstract class GLContext { * 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(final int major, final int minor, final int ctp) throws GLException { if(0 != ( CTX_PROFILE_COMPAT & ctp )) { if(major >= 4) { return GLProfile.GL4bc; } @@ -1714,7 +1714,7 @@ public abstract class GLContext { /** * Returns the GLProfile's major version number at reqMajorCTP[0] and it's context property (CTP) at reqMajorCTP[1] for availability mapping request. */ - protected static final void getRequestMajorAndCompat(final GLProfile glp, int[/*2*/] reqMajorCTP) { + protected static final void getRequestMajorAndCompat(final GLProfile glp, final int[/*2*/] reqMajorCTP) { final GLProfile glpImpl = glp.getImpl(); if( glpImpl.isGL4() ) { reqMajorCTP[0]=4; @@ -1743,9 +1743,9 @@ public abstract class GLContext { final int[] reqMajorCTP = new int[] { 0, 0 }; getRequestMajorAndCompat(glp, reqMajorCTP); - int _major[] = { 0 }; - int _minor[] = { 0 }; - int _ctp[] = { 0 }; + final int _major[] = { 0 }; + final int _minor[] = { 0 }; + final int _ctp[] = { 0 }; if( GLContext.getAvailableGLVersion(device, reqMajorCTP[0], reqMajorCTP[1], _major, _minor, _ctp)) { return _ctp[0]; } @@ -1758,7 +1758,7 @@ public abstract class GLContext { * @param profile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES} * @return the highest GLProfile for the device regarding availability, version and profile bits. */ - protected static GLProfile getAvailableGLProfile(AbstractGraphicsDevice device, int reqMajor, int reqProfile) + protected static GLProfile getAvailableGLProfile(final AbstractGraphicsDevice device, final int reqMajor, final int reqProfile) throws GLException { final String glpName = getAvailableGLProfileName(device, reqMajor, reqProfile); return null != glpName ? GLProfile.get(device, glpName) : null; @@ -1770,11 +1770,11 @@ public abstract class GLContext { * @param profile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES} * @return the highest GLProfile name for the device regarding availability, version and profile bits. */ - /* package */ static String getAvailableGLProfileName(AbstractGraphicsDevice device, int reqMajor, int reqProfile) + /* package */ static String getAvailableGLProfileName(final AbstractGraphicsDevice device, final int reqMajor, final int reqProfile) throws GLException { - int major[] = { 0 }; - int minor[] = { 0 }; - int ctp[] = { 0 }; + final int major[] = { 0 }; + final int minor[] = { 0 }; + final int ctp[] = { 0 }; if(GLContext.getAvailableGLVersion(device, reqMajor, reqProfile, major, minor, ctp)) { return GLContext.getGLProfile(major[0], minor[0], ctp[0]); } @@ -1786,10 +1786,10 @@ public abstract class GLContext { * @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} */ - protected static String getAvailableGLVersionAsString(AbstractGraphicsDevice device, int major, int profile) { - int _major[] = { 0 }; - int _minor[] = { 0 }; - int _ctp[] = { 0 }; + protected static String getAvailableGLVersionAsString(final AbstractGraphicsDevice device, final int major, final int profile) { + final int _major[] = { 0 }; + final int _minor[] = { 0 }; + final int _ctp[] = { 0 }; if(getAvailableGLVersion(device, major, profile, _major, _minor, _ctp)) { return getGLVersion(_major[0], _minor[0], _ctp[0], null); } @@ -1809,7 +1809,7 @@ public abstract class GLContext { * @param glp {@link GLProfile} to check for FBO capabilities * @see GLContext#hasBasicFBOSupport() */ - public static final boolean isFBOAvailable(AbstractGraphicsDevice device, GLProfile glp) { + public static final boolean isFBOAvailable(final AbstractGraphicsDevice device, final GLProfile glp) { return 0 != ( CTX_IMPL_FBO & getAvailableContextProperties(device, glp) ); } @@ -1818,7 +1818,7 @@ public abstract class GLContext { * @see GLContext#isHardwareRasterizer() * @see GLProfile#isHardwareRasterizer() */ - public static final int isHardwareRasterizer(AbstractGraphicsDevice device, GLProfile glp) { + public static final int isHardwareRasterizer(final AbstractGraphicsDevice device, final GLProfile glp) { final int r; final int ctp = getAvailableContextProperties(device, glp); if(0 == ctp) { @@ -1838,8 +1838,8 @@ public abstract class GLContext { * @param isHardware return value of one boolean, whether the profile is a hardware rasterizer or not * @return true if the requested GL version is available regardless of a software or hardware rasterizer, otherwise false. */ - protected static boolean isGLVersionAvailable(AbstractGraphicsDevice device, int reqMajor, int reqProfile, boolean isHardware[]) { - Integer valI = getAvailableGLVersion(device, reqMajor, reqProfile); + protected static boolean isGLVersionAvailable(final AbstractGraphicsDevice device, final int reqMajor, final int reqProfile, final boolean isHardware[]) { + final Integer valI = getAvailableGLVersion(device, reqMajor, reqProfile); if(null==valI) { return false; } @@ -1847,15 +1847,15 @@ public abstract class GLContext { return true; } - public static boolean isGLES1Available(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGLES1Available(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 1, GLContext.CTX_PROFILE_ES, isHardware); } - public static boolean isGLES2Available(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGLES2Available(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 2, GLContext.CTX_PROFILE_ES, isHardware); } - public static boolean isGLES3Available(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGLES3Available(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 3, GLContext.CTX_PROFILE_ES, isHardware); } @@ -1867,10 +1867,10 @@ public abstract class GLContext { * Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ] * </p> */ - public static final boolean isGLES3CompatibleAvailable(AbstractGraphicsDevice device) { - int major[] = { 0 }; - int minor[] = { 0 }; - int ctp[] = { 0 }; + public static final boolean isGLES3CompatibleAvailable(final AbstractGraphicsDevice device) { + final int major[] = { 0 }; + final int minor[] = { 0 }; + final int ctp[] = { 0 }; boolean ok; ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_ES, major, minor, ctp); @@ -1883,29 +1883,29 @@ public abstract class GLContext { return 0 != ( ctp[0] & CTX_IMPL_ES3_COMPAT ); } - public static boolean isGL4bcAvailable(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGL4bcAvailable(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 4, CTX_PROFILE_COMPAT, isHardware); } - public static boolean isGL4Available(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGL4Available(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 4, CTX_PROFILE_CORE, isHardware); } - public static boolean isGL3bcAvailable(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGL3bcAvailable(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 3, CTX_PROFILE_COMPAT, isHardware); } - public static boolean isGL3Available(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGL3Available(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 3, CTX_PROFILE_CORE, isHardware); } - public static boolean isGL2Available(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGL2Available(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 2, CTX_PROFILE_COMPAT, isHardware); } - protected static String getGLVersion(int major, int minor, int ctp, String gl_version) { + protected static String getGLVersion(final int major, final int minor, final int ctp, final String gl_version) { boolean needColon = false; - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(major); sb.append("."); sb.append(minor); @@ -1937,15 +1937,15 @@ public abstract class GLContext { // internal string utils // - protected static String toHexString(int hex) { + protected static String toHexString(final int hex) { return "0x" + Integer.toHexString(hex); } - protected static String toHexString(long hex) { + protected static String toHexString(final long hex) { return "0x" + Long.toHexString(hex); } - private static boolean appendString(StringBuilder sb, String string, boolean needColon, boolean condition) { + private static boolean appendString(final StringBuilder sb, final String string, boolean needColon, final boolean condition) { if(condition) { if(needColon) { sb.append(", "); diff --git a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java b/src/jogl/classes/javax/media/opengl/GLDebugMessage.java index acb33b058..325345012 100644 --- a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java +++ b/src/jogl/classes/javax/media/opengl/GLDebugMessage.java @@ -51,7 +51,7 @@ public class GLDebugMessage { * @param dbgSeverity The ARB severity level * @param dbgMsg The debug message */ - public GLDebugMessage(GLContext source, long when, int dbgSource, int dbgType, int dbgId, int dbgSeverity, String dbgMsg) { + public GLDebugMessage(final GLContext source, final long when, final int dbgSource, final int dbgType, final int dbgId, final int dbgSeverity, final String dbgMsg) { this.source = source; this.when = when; this.dbgSource = dbgSource; @@ -71,14 +71,14 @@ public class GLDebugMessage { * @param dbgMsg * @return */ - public static GLDebugMessage translateAMDEvent(GLContext source, long when, int dbgId, int amdDbgCategory, int dbgSeverity, String dbgMsg) { + public static GLDebugMessage translateAMDEvent(final GLContext source, final long when, final int dbgId, final int amdDbgCategory, final int dbgSeverity, final String dbgMsg) { int dbgSource, dbgType; // AMD category == ARB source/type switch(amdDbgCategory) { case GL2GL3.GL_DEBUG_CATEGORY_API_ERROR_AMD: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_API; - dbgType = GL2GL3.GL_DEBUG_TYPE_ERROR; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_API; + dbgType = GL2ES2.GL_DEBUG_TYPE_ERROR; break; // @@ -86,18 +86,18 @@ public class GLDebugMessage { // case GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM; - dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_WINDOW_SYSTEM; + dbgType = GL2ES2.GL_DEBUG_TYPE_OTHER; break; case GL2GL3.GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER; - dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_SHADER_COMPILER; + dbgType = GL2ES2.GL_DEBUG_TYPE_OTHER; break; case GL2GL3.GL_DEBUG_CATEGORY_APPLICATION_AMD: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_APPLICATION; - dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_APPLICATION; + dbgType = GL2ES2.GL_DEBUG_TYPE_OTHER; break; @@ -106,49 +106,49 @@ public class GLDebugMessage { // case GL2GL3.GL_DEBUG_CATEGORY_DEPRECATION_AMD: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER; - dbgType = GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_OTHER; + dbgType = GL2ES2.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR; break; case GL2GL3.GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER; - dbgType = GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_OTHER; + dbgType = GL2ES2.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR; break; case GL2GL3.GL_DEBUG_CATEGORY_PERFORMANCE_AMD: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER; - dbgType = GL2GL3.GL_DEBUG_TYPE_PERFORMANCE; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_OTHER; + dbgType = GL2ES2.GL_DEBUG_TYPE_PERFORMANCE; break; case GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD: default: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER; - dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_OTHER; + dbgType = GL2ES2.GL_DEBUG_TYPE_OTHER; } return new GLDebugMessage(source, when, dbgSource, dbgType, dbgId, dbgSeverity, dbgMsg); } - public static int translateARB2AMDCategory(int dbgSource, int dbgType) { + public static int translateARB2AMDCategory(final int dbgSource, final int dbgType) { switch (dbgSource) { - case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM: + case GL2ES2.GL_DEBUG_SOURCE_WINDOW_SYSTEM: return GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD; - case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER: + case GL2ES2.GL_DEBUG_SOURCE_SHADER_COMPILER: return GL2GL3.GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD; - case GL2GL3.GL_DEBUG_SOURCE_APPLICATION: + case GL2ES2.GL_DEBUG_SOURCE_APPLICATION: return GL2GL3.GL_DEBUG_CATEGORY_APPLICATION_AMD; } switch(dbgType) { - case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: + case GL2ES2.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return GL2GL3.GL_DEBUG_CATEGORY_DEPRECATION_AMD; - case GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: + case GL2ES2.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: return GL2GL3.GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD; - case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE: + case GL2ES2.GL_DEBUG_TYPE_PERFORMANCE: return GL2GL3.GL_DEBUG_CATEGORY_PERFORMANCE_AMD; } @@ -207,46 +207,46 @@ public class GLDebugMessage { return toString(null).toString(); } - public static String getDbgSourceString(int dbgSource) { + public static String getDbgSourceString(final int dbgSource) { switch(dbgSource) { - case GL2GL3.GL_DEBUG_SOURCE_API: return "GL API"; - case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER: return "GLSL or extension compiler"; - case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM: return "Native Windowing binding"; - case GL2GL3.GL_DEBUG_SOURCE_THIRD_PARTY: return "Third party"; - case GL2GL3.GL_DEBUG_SOURCE_APPLICATION: return "Application"; - case GL2GL3.GL_DEBUG_SOURCE_OTHER: return "generic"; + case GL2ES2.GL_DEBUG_SOURCE_API: return "GL API"; + case GL2ES2.GL_DEBUG_SOURCE_SHADER_COMPILER: return "GLSL or extension compiler"; + case GL2ES2.GL_DEBUG_SOURCE_WINDOW_SYSTEM: return "Native Windowing binding"; + case GL2ES2.GL_DEBUG_SOURCE_THIRD_PARTY: return "Third party"; + case GL2ES2.GL_DEBUG_SOURCE_APPLICATION: return "Application"; + case GL2ES2.GL_DEBUG_SOURCE_OTHER: return "generic"; default: return "Unknown (" + toHexString(dbgSource) + ")"; } } - public static String getDbgTypeString(int dbgType) { + public static String getDbgTypeString(final int dbgType) { switch(dbgType) { - case GL2GL3.GL_DEBUG_TYPE_ERROR: return "Error"; - case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return "Warning: marked for deprecation"; - case GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: return "Warning: undefined behavior"; - case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE: return "Warning: implementation dependent performance"; - case GL2GL3.GL_DEBUG_TYPE_PORTABILITY: return "Warning: vendor-specific extension use"; - case GL2GL3.GL_DEBUG_TYPE_OTHER: return "Warning: generic"; + case GL2ES2.GL_DEBUG_TYPE_ERROR: return "Error"; + case GL2ES2.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return "Warning: marked for deprecation"; + case GL2ES2.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: return "Warning: undefined behavior"; + case GL2ES2.GL_DEBUG_TYPE_PERFORMANCE: return "Warning: implementation dependent performance"; + case GL2ES2.GL_DEBUG_TYPE_PORTABILITY: return "Warning: vendor-specific extension use"; + case GL2ES2.GL_DEBUG_TYPE_OTHER: return "Warning: generic"; default: return "Unknown (" + toHexString(dbgType) + ")"; } } - public static String getDbgSeverityString(int dbgSeverity) { + public static String getDbgSeverityString(final int dbgSeverity) { switch(dbgSeverity) { - case GL2GL3.GL_DEBUG_SEVERITY_HIGH: return "High: dangerous undefined behavior"; - case GL2GL3.GL_DEBUG_SEVERITY_MEDIUM: return "Medium: Severe performance/deprecation/other warnings"; - case GL2GL3.GL_DEBUG_SEVERITY_LOW: return "Low: Performance warnings (redundancy/undefined)"; + case GL2ES2.GL_DEBUG_SEVERITY_HIGH: return "High: dangerous undefined behavior"; + case GL2ES2.GL_DEBUG_SEVERITY_MEDIUM: return "Medium: Severe performance/deprecation/other warnings"; + case GL2ES2.GL_DEBUG_SEVERITY_LOW: return "Low: Performance warnings (redundancy/undefined)"; default: return "Unknown (" + toHexString(dbgSeverity) + ")"; } } - public static StringBuilder toHexString(StringBuilder sb, int i) { + public static StringBuilder toHexString(StringBuilder sb, final int i) { if(null==sb) { sb = new StringBuilder(); } return sb.append("0x").append(Integer.toHexString(i)); } - public static String toHexString(int i) { + public static String toHexString(final int i) { return "0x"+Integer.toHexString(i); } diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index 077daf6e9..6e7caf8f8 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -43,6 +43,7 @@ package javax.media.opengl; import java.util.ArrayList; import java.util.List; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; import com.jogamp.opengl.GLAutoDrawableDelegate; import com.jogamp.opengl.GLRendererQuirks; @@ -142,8 +143,8 @@ public abstract class GLDrawableFactory { final String nwt = NativeWindowFactory.getNativeWindowType(true); GLDrawableFactory tmp = null; - String factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true); - ClassLoader cl = GLDrawableFactory.class.getClassLoader(); + String factoryClassName = PropertyAccess.getProperty("jogl.gldrawablefactory.class.name", true); + final ClassLoader cl = GLDrawableFactory.class.getClassLoader(); if (null == factoryClassName) { if ( nwt == NativeWindowFactory.TYPE_X11 ) { factoryClassName = "jogamp.opengl.x11.glx.X11GLXDrawableFactory"; @@ -164,7 +165,7 @@ public abstract class GLDrawableFactory { } try { tmp = (GLDrawableFactory) ReflectionUtil.createInstance(factoryClassName, cl); - } catch (Exception jre) { + } catch (final Exception jre) { if (DEBUG || GLProfile.DEBUG) { System.err.println("Info: GLDrawableFactory.static - Native Platform: "+nwt+" - not available: "+factoryClassName); jre.printStackTrace(); @@ -179,7 +180,7 @@ public abstract class GLDrawableFactory { if(!disableOpenGLES) { try { tmp = (GLDrawableFactory) ReflectionUtil.createInstance("jogamp.opengl.egl.EGLDrawableFactory", cl); - } catch (Exception jre) { + } catch (final Exception jre) { if (DEBUG || GLProfile.DEBUG) { System.err.println("Info: GLDrawableFactory.static - EGLDrawableFactory - not available"); jre.printStackTrace(); @@ -221,7 +222,7 @@ public abstract class GLDrawableFactory { try { gldf.resetDisplayGamma(); gldf.shutdownImpl(); - } catch (Throwable t) { + } catch (final Throwable t) { System.err.println("GLDrawableFactory.shutdownImpl: Caught "+t.getClass().getName()+" during factory shutdown #"+(i+1)+"/"+gldfCount+" "+gldf.getClass().getName()); if( DEBUG ) { t.printStackTrace(); @@ -322,7 +323,7 @@ public abstract class GLDrawableFactory { * @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. * @return true if a shared resource could been created, otherwise false. */ - protected final boolean createSharedResource(AbstractGraphicsDevice device) { + protected final boolean createSharedResource(final AbstractGraphicsDevice device) { return createSharedResourceImpl(device); } protected abstract boolean createSharedResourceImpl(AbstractGraphicsDevice device); @@ -343,7 +344,7 @@ public abstract class GLDrawableFactory { * @see #getRendererQuirks(AbstractGraphicsDevice) * @see GLRendererQuirks */ - public final boolean hasRendererQuirk(AbstractGraphicsDevice device, int quirk) { + public final boolean hasRendererQuirk(final AbstractGraphicsDevice device, final int quirk) { final GLRendererQuirks glrq = getRendererQuirks(device); return null != glrq ? glrq.exist(quirk) : false; } @@ -385,11 +386,11 @@ public abstract class GLDrawableFactory { * @param glProfile GLProfile to determine the factory type, ie EGLDrawableFactory, * or one of the native GLDrawableFactory's, ie X11/GLX, Windows/WGL or MacOSX/CGL. */ - public static GLDrawableFactory getFactory(GLProfile glProfile) throws GLException { + public static GLDrawableFactory getFactory(final GLProfile glProfile) throws GLException { return getFactoryImpl(glProfile.getImplName()); } - protected static GLDrawableFactory getFactoryImpl(String glProfileImplName) throws GLException { + protected static GLDrawableFactory getFactoryImpl(final String glProfileImplName) throws GLException { if ( GLProfile.usesNativeGLES(glProfileImplName) ) { if(null!=eglFactory) { return eglFactory; @@ -400,7 +401,7 @@ public abstract class GLDrawableFactory { throw new GLException("No GLDrawableFactory available for profile: "+glProfileImplName); } - protected static GLDrawableFactory getFactoryImpl(AbstractGraphicsDevice device) throws GLException { + protected static GLDrawableFactory getFactoryImpl(final AbstractGraphicsDevice device) throws GLException { if(null != nativeOSFactory && nativeOSFactory.getIsDeviceCompatible(device)) { return nativeOSFactory; } diff --git a/src/jogl/classes/javax/media/opengl/GLException.java b/src/jogl/classes/javax/media/opengl/GLException.java index 460f17be9..6a287c969 100644 --- a/src/jogl/classes/javax/media/opengl/GLException.java +++ b/src/jogl/classes/javax/media/opengl/GLException.java @@ -50,19 +50,19 @@ public class GLException extends RuntimeException { /** Constructs a GLException object with the specified detail message. */ - public GLException(String message) { + public GLException(final String message) { super(message); } /** Constructs a GLException object with the specified detail message and root cause. */ - public GLException(String message, Throwable cause) { + public GLException(final String message, final Throwable cause) { super(message, cause); } /** Constructs a GLException object with the specified root cause. */ - public GLException(Throwable cause) { + public GLException(final Throwable cause) { super(cause); } } diff --git a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java index d947bada2..ab12ba17c 100644 --- a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java @@ -88,7 +88,7 @@ public class GLPipelineFactory { * @param downstream is always the 1st argument for the upstream constructor * @param additionalArgs additional arguments for the upstream constructor */ - public static final GL create(String pipelineClazzBaseName, Class<?> reqInterface, GL downstream, Object[] additionalArgs) { + public static final GL create(final String pipelineClazzBaseName, final Class<?> reqInterface, final GL downstream, final Object[] additionalArgs) { Class<?> downstreamClazz = downstream.getClass(); Class<?> upstreamClazz = null; Class<?> interfaceClazz = null; @@ -101,7 +101,7 @@ public class GLPipelineFactory { do { // For all interfaces: right -> left == child -> parent // It is important that this matches with the gluegen cfg file's 'Implements' clause ! - Class<?>[] clazzes = downstreamClazz.getInterfaces(); + final Class<?>[] clazzes = downstreamClazz.getInterfaces(); for(int i=clazzes.length-1; null==upstreamClazz && i>=0; i--) { if(DEBUG) { System.out.println("GLPipelineFactory: Try "+downstreamClazz.getName()+" Interface["+i+"]: "+clazzes[i].getName()); @@ -142,7 +142,7 @@ public class GLPipelineFactory { System.out.println("GLPipelineFactory: Got : "+ upstreamClazz.getName()+", base interface: "+interfaceClazz.getName()); } - Class<?>[] cstrArgTypes = new Class<?>[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ; + final Class<?>[] cstrArgTypes = new Class<?>[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ; { int i = 0; cstrArgTypes[i++] = interfaceClazz; @@ -151,10 +151,10 @@ public class GLPipelineFactory { } } // throws exception if cstr not found! - Constructor<?> cstr = ReflectionUtil.getConstructor(upstreamClazz, cstrArgTypes); + final Constructor<?> cstr = ReflectionUtil.getConstructor(upstreamClazz, cstrArgTypes); Object instance = null; try { - Object[] cstrArgs = new Object[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ; + final Object[] cstrArgs = new Object[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ; { int i = 0; cstrArgs[i++] = downstream; @@ -163,7 +163,7 @@ public class GLPipelineFactory { } } instance = cstr.newInstance( cstrArgs ) ; - } catch (Throwable t) { t.printStackTrace(); } + } catch (final Throwable t) { t.printStackTrace(); } if(null==instance) { throw new GLException("Error: Couldn't create instance of pipeline: "+upstreamClazz.getName()+ " ( "+getArgsClassNameList(downstreamClazz, additionalArgs) +" )"); @@ -174,8 +174,8 @@ public class GLPipelineFactory { return (GL) instance; } - private static final String getArgsClassNameList(Class<?> arg0, Object[] args) { - StringBuilder sb = new StringBuilder(); + private static final String getArgsClassNameList(final Class<?> arg0, final Object[] args) { + final StringBuilder sb = new StringBuilder(); sb.append(arg0.getName()); if(args!=null) { for(int j=0; j<args.length; j++) { @@ -186,20 +186,20 @@ public class GLPipelineFactory { return sb.toString(); } - private static final Class<?> getUpstreamClazz(Class<?> downstreamClazz, String pipelineClazzBaseName) { - String downstreamClazzName = downstreamClazz.getName(); + private static final Class<?> getUpstreamClazz(final Class<?> downstreamClazz, final String pipelineClazzBaseName) { + final String downstreamClazzName = downstreamClazz.getName(); - StringTokenizer st = new StringTokenizer(downstreamClazzName, "."); + final StringTokenizer st = new StringTokenizer(downstreamClazzName, "."); String downstreamClazzBaseName = downstreamClazzName; while(st.hasMoreTokens()) { downstreamClazzBaseName = st.nextToken(); } - String upstreamClazzName = pipelineClazzBaseName+downstreamClazzBaseName; + final String upstreamClazzName = pipelineClazzBaseName+downstreamClazzBaseName; Class<?> upstreamClazz = null; try { upstreamClazz = Class.forName(upstreamClazzName, true, GLPipelineFactory.class.getClassLoader()); - } catch (Throwable e) { e.printStackTrace(); } + } catch (final Throwable e) { e.printStackTrace(); } return upstreamClazz; } diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index addc977d8..57367adcc 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -167,7 +167,7 @@ public class GLProfile { * * @throws GLException if no profile for the given device is available. */ - public static void initProfiles(AbstractGraphicsDevice device) throws GLException { + public static void initProfiles(final AbstractGraphicsDevice device) throws GLException { getProfileMap(device, true); } @@ -208,11 +208,11 @@ public class GLProfile { * or <code>[ null, GL ]</code> for the default profile. * @return true if the profile is available for the device, otherwise false. */ - public static boolean isAvailable(AbstractGraphicsDevice device, String profile) { + public static boolean isAvailable(final AbstractGraphicsDevice device, final String profile) { initSingleton(); return isAvailableImpl(getProfileMap(device, false), profile); } - private static boolean isAvailableImpl(HashMap<String /*GLProfile_name*/, GLProfile> map, String profile) { + private static boolean isAvailableImpl(final HashMap<String /*GLProfile_name*/, GLProfile> map, final String profile) { return null != map && null != map.get(profile); } @@ -223,7 +223,7 @@ public class GLProfile { * or <code>[ null, GL ]</code> for the default profile. * @return true if the profile is available for the default device, otherwise false. */ - public static boolean isAvailable(String profile) { + public static boolean isAvailable(final String profile) { return isAvailable(null, profile); } @@ -236,21 +236,21 @@ public class GLProfile { return isAvailable(null, null); } - public static String glAvailabilityToString(AbstractGraphicsDevice device) { + public static String glAvailabilityToString(final AbstractGraphicsDevice device) { return glAvailabilityToString(device, null).toString(); } - public static StringBuilder glAvailabilityToString(AbstractGraphicsDevice device, StringBuilder sb) { + public static StringBuilder glAvailabilityToString(final AbstractGraphicsDevice device, final StringBuilder sb) { return glAvailabilityToString(device, sb, null, 0); } - private static StringBuilder doIndent(StringBuilder sb, String indent, int indentCount) { + private static StringBuilder doIndent(final StringBuilder sb, final String indent, int indentCount) { while(indentCount>0) { sb.append(indent); indentCount--; } return sb; } - public static StringBuilder glAvailabilityToString(AbstractGraphicsDevice device, StringBuilder sb, String indent, int indentCount) { + public static StringBuilder glAvailabilityToString(AbstractGraphicsDevice device, StringBuilder sb, final String indent, int indentCount) { boolean avail; if(null == sb) { sb = new StringBuilder(); @@ -425,7 +425,7 @@ public class GLProfile { int profileCount = 0; if(null != map) { - for (Map.Entry<String,GLProfile> entry : map.entrySet()) { + for (final Map.Entry<String,GLProfile> entry : map.entrySet()) { if( !GL_DEFAULT.equals(entry.getKey()) ) { if(useIndent) { doIndent(sb.append(Platform.getNewline()), indent, indentCount); @@ -444,7 +444,7 @@ public class GLProfile { } try { sb.append(getDefault(device)); - } catch (GLException gle) { + } catch (final GLException gle) { sb.append("n/a"); } } @@ -628,8 +628,8 @@ public class GLProfile { * @throws GLException if no profile is available for the device. * @see #GL_PROFILE_LIST_ALL */ - public static GLProfile getDefault(AbstractGraphicsDevice device) { - GLProfile glp = get(device, GL_DEFAULT); + public static GLProfile getDefault(final AbstractGraphicsDevice device) { + final GLProfile glp = get(device, GL_DEFAULT); return glp; } @@ -650,7 +650,7 @@ public class GLProfile { * @throws GLException if no profile is available for the device. * @see #GL_PROFILE_LIST_MAX */ - public static GLProfile getMaximum(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) + public static GLProfile getMaximum(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer) throws GLException { return get(device, GL_PROFILE_LIST_MAX, favorHardwareRasterizer); @@ -660,7 +660,7 @@ public class GLProfile { * @throws GLException if no profile is available for the default device. * @see #GL_PROFILE_LIST_MAX */ - public static GLProfile getMaximum(boolean favorHardwareRasterizer) + public static GLProfile getMaximum(final boolean favorHardwareRasterizer) throws GLException { return get(GL_PROFILE_LIST_MAX, favorHardwareRasterizer); @@ -673,7 +673,7 @@ public class GLProfile { * @throws GLException if no desktop profile is available for the device. * @see #GL_PROFILE_LIST_MIN */ - public static GLProfile getMinimum(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) + public static GLProfile getMinimum(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer) throws GLException { return get(device, GL_PROFILE_LIST_MIN, favorHardwareRasterizer); @@ -683,7 +683,7 @@ public class GLProfile { * @throws GLException if no desktop profile is available for the default device. * @see #GL_PROFILE_LIST_MIN */ - public static GLProfile getMinimum(boolean favorHardwareRasterizer) + public static GLProfile getMinimum(final boolean favorHardwareRasterizer) throws GLException { return get(GL_PROFILE_LIST_MIN, favorHardwareRasterizer); @@ -697,7 +697,7 @@ public class GLProfile { * @throws GLException if no fixed function profile is available for the device. * @see #GL_PROFILE_LIST_MAX_FIXEDFUNC */ - public static GLProfile getMaxFixedFunc(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) + public static GLProfile getMaxFixedFunc(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer) throws GLException { return get(device, GL_PROFILE_LIST_MAX_FIXEDFUNC, favorHardwareRasterizer); @@ -707,7 +707,7 @@ public class GLProfile { * @throws GLException if no fixed function profile is available for the default device. * @see #GL_PROFILE_LIST_MAX_FIXEDFUNC */ - public static GLProfile getMaxFixedFunc(boolean favorHardwareRasterizer) + public static GLProfile getMaxFixedFunc(final boolean favorHardwareRasterizer) throws GLException { return get(GL_PROFILE_LIST_MAX_FIXEDFUNC, favorHardwareRasterizer); @@ -720,7 +720,7 @@ public class GLProfile { * @throws GLException if no programmable profile is available for the device. * @see #GL_PROFILE_LIST_MAX_PROGSHADER */ - public static GLProfile getMaxProgrammable(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) + public static GLProfile getMaxProgrammable(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer) throws GLException { return get(device, GL_PROFILE_LIST_MAX_PROGSHADER, favorHardwareRasterizer); @@ -730,7 +730,7 @@ public class GLProfile { * @throws GLException if no programmable profile is available for the default device. * @see #GL_PROFILE_LIST_MAX_PROGSHADER */ - public static GLProfile getMaxProgrammable(boolean favorHardwareRasterizer) + public static GLProfile getMaxProgrammable(final boolean favorHardwareRasterizer) throws GLException { return get(GL_PROFILE_LIST_MAX_PROGSHADER, favorHardwareRasterizer); @@ -743,7 +743,7 @@ public class GLProfile { * @throws GLException if no programmable core profile is available for the device. * @see #GL_PROFILE_LIST_MAX_PROGSHADER_CORE */ - public static GLProfile getMaxProgrammableCore(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) + public static GLProfile getMaxProgrammableCore(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer) throws GLException { return get(device, GL_PROFILE_LIST_MAX_PROGSHADER_CORE, favorHardwareRasterizer); @@ -753,7 +753,7 @@ public class GLProfile { * @throws GLException if no programmable core profile is available for the default device. * @see #GL_PROFILE_LIST_MAX_PROGSHADER_CORE */ - public static GLProfile getMaxProgrammableCore(boolean favorHardwareRasterizer) + public static GLProfile getMaxProgrammableCore(final boolean favorHardwareRasterizer) throws GLException { return get(GL_PROFILE_LIST_MAX_PROGSHADER_CORE, favorHardwareRasterizer); @@ -772,7 +772,7 @@ public class GLProfile { * @see #get(AbstractGraphicsDevice, String) * @see #getImpl() */ - public static GLProfile getGL2ES1(AbstractGraphicsDevice device) + public static GLProfile getGL2ES1(final AbstractGraphicsDevice device) throws GLException { return get(device, GL2ES1).getImpl(); @@ -802,7 +802,7 @@ public class GLProfile { * @see #get(AbstractGraphicsDevice, String) * @see #getImpl() */ - public static GLProfile getGL2ES2(AbstractGraphicsDevice device) + public static GLProfile getGL2ES2(final AbstractGraphicsDevice device) throws GLException { return get(device, GL2ES2).getImpl(); @@ -832,7 +832,7 @@ public class GLProfile { * @see #get(AbstractGraphicsDevice, String) * @see #getImpl() */ - public static GLProfile getGL4ES3(AbstractGraphicsDevice device) + public static GLProfile getGL4ES3(final AbstractGraphicsDevice device) throws GLException { return get(device, GL4ES3).getImpl(); @@ -862,7 +862,7 @@ public class GLProfile { * @see #get(AbstractGraphicsDevice, String) * @see #getImpl() */ - public static GLProfile getGL2GL3(AbstractGraphicsDevice device) + public static GLProfile getGL2GL3(final AbstractGraphicsDevice device) throws GLException { return get(device, GL2GL3).getImpl(); @@ -889,7 +889,7 @@ public class GLProfile { * or <code>[ null, GL ]</code> for the default profile. * @throws GLException if the requested profile is not available for the device. */ - public static GLProfile get(AbstractGraphicsDevice device, String profile) + public static GLProfile get(final AbstractGraphicsDevice device, String profile) throws GLException { if(null==profile || profile.equals("GL")) { @@ -908,7 +908,7 @@ public class GLProfile { * or <code>[ null, GL ]</code> for the default profile. * @throws GLException if the requested profile is not available for the default device. */ - public static GLProfile get(String profile) + public static GLProfile get(final String profile) throws GLException { return get(defaultDevice, profile); @@ -923,12 +923,12 @@ public class GLProfile { * @param favorHardwareRasterizer set to true, if hardware rasterizer shall be favored, otherwise false. * @throws GLException if the non of the requested profiles is available for the device. */ - public static GLProfile get(AbstractGraphicsDevice device, String[] profiles, boolean favorHardwareRasterizer) + public static GLProfile get(final AbstractGraphicsDevice device, final String[] profiles, final boolean favorHardwareRasterizer) throws GLException { GLProfile glProfileAny = null; - HashMap<String /*GLProfile_name*/, GLProfile> map = getProfileMap(device, true); + final HashMap<String /*GLProfile_name*/, GLProfile> map = getProfileMap(device, true); for(int i=0; i<profiles.length; i++) { final GLProfile glProfile = map.get(profiles[i]); if(null!=glProfile) { @@ -954,7 +954,7 @@ public class GLProfile { * @param favorHardwareRasterizer set to true, if hardware rasterizer shall be favored, otherwise false. * @throws GLException if the non of the requested profiles is available for the default device. */ - public static GLProfile get(String[] profiles, boolean favorHardwareRasterizer) + public static GLProfile get(final String[] profiles, final boolean favorHardwareRasterizer) throws GLException { return get(defaultDevice, profiles, favorHardwareRasterizer); @@ -963,26 +963,26 @@ public class GLProfile { /** Indicates whether the native OpenGL ES1 profile is in use. * This requires an EGL interface. */ - public static boolean usesNativeGLES1(String profileImpl) { + public static boolean usesNativeGLES1(final String profileImpl) { return GLES1.equals(profileImpl); } /** Indicates whether the native OpenGL ES3 or ES2 profile is in use. * This requires an EGL, ES3 or ES2 compatible interface. */ - public static boolean usesNativeGLES2(String profileImpl) { + public static boolean usesNativeGLES2(final String profileImpl) { return GLES3.equals(profileImpl) || GLES2.equals(profileImpl); } /** Indicates whether the native OpenGL ES2 profile is in use. * This requires an EGL, ES3 compatible interface. */ - public static boolean usesNativeGLES3(String profileImpl) { + public static boolean usesNativeGLES3(final String profileImpl) { return GLES3.equals(profileImpl); } /** Indicates whether either of the native OpenGL ES profiles are in use. */ - public static boolean usesNativeGLES(String profileImpl) { + public static boolean usesNativeGLES(final String profileImpl) { return usesNativeGLES2(profileImpl) || usesNativeGLES1(profileImpl); } @@ -990,7 +990,7 @@ public class GLProfile { JOGL's AWT part */ public static boolean isAWTAvailable() { return isAWTAvailable; } - public static String getGLTypeName(int type) { + public static String getGLTypeName(final int type) { switch (type) { case GL.GL_UNSIGNED_BYTE: return "GL_UNSIGNED_BYTE"; @@ -1006,9 +1006,9 @@ public class GLProfile { return "GL_FIXED"; case javax.media.opengl.GL2ES2.GL_INT: return "GL_INT"; - case javax.media.opengl.GL2ES2.GL_UNSIGNED_INT: + case GL.GL_UNSIGNED_INT: return "GL_UNSIGNED_INT"; - case javax.media.opengl.GL2.GL_DOUBLE: + case javax.media.opengl.GL2GL3.GL_DOUBLE: return "GL_DOUBLE"; case javax.media.opengl.GL2.GL_2_BYTES: return "GL_2_BYTES"; @@ -1020,7 +1020,7 @@ public class GLProfile { return null; } - public static String getGLArrayName(int array) { + public static String getGLArrayName(final int array) { switch(array) { case GLPointerFunc.GL_VERTEX_ARRAY: return "GL_VERTEX_ARRAY"; @@ -1037,7 +1037,7 @@ public class GLProfile { public final String getGLImplBaseClassName() { return getGLImplBaseClassName(getImplName()); } - private static final String getGLImplBaseClassName(String profileImpl) { + private static final String getGLImplBaseClassName(final String profileImpl) { if( GLES2 == profileImpl || GLES3 == profileImpl ) { return "jogamp.opengl.es3.GLES3"; } else if( GLES1 == profileImpl ) { @@ -1053,10 +1053,10 @@ public class GLProfile { } } - public final Constructor<?> getGLCtor(boolean glObject) { + public final Constructor<?> getGLCtor(final boolean glObject) { return getGLCtor(getImplName(), glObject); } - private static final Constructor<?> getGLCtor(String profileImpl, boolean glObject) { + private static final Constructor<?> getGLCtor(final String profileImpl, final boolean glObject) { if( GLES2 == profileImpl || GLES3 == profileImpl ) { return glObject ? ctorGLES3Impl : ctorGLES3ProcAddr; } else if( GLES1 == profileImpl ) { @@ -1078,7 +1078,7 @@ public class GLProfile { * if both, profile and profileImpl is equal with this. */ @Override - public final boolean equals(Object o) { + public final boolean equals(final Object o) { if(this==o) { return true; } if(o instanceof GLProfile) { final GLProfile glp = (GLProfile)o; @@ -1099,7 +1099,7 @@ public class GLProfile { * @param glp GLProfile to compare with * @throws GLException if given GLProfile and this aren't equal */ - public final void verifyEquality(GLProfile glp) throws GLException { + public final void verifyEquality(final GLProfile glp) throws GLException { if(!this.equals(glp)) { throw new GLException("GLProfiles are not equal: "+this+" != "+glp); } @@ -1235,7 +1235,7 @@ public class GLProfile { * General validation if type is a valid GL data type * for the current profile */ - public boolean isValidDataType(int type, boolean throwException) { + public boolean isValidDataType(final int type, final boolean throwException) { switch(type) { case GL.GL_UNSIGNED_BYTE: case GL.GL_BYTE: @@ -1245,11 +1245,11 @@ public class GLProfile { case GL.GL_FIXED: return true; case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2ES2.GL_UNSIGNED_INT: + case GL.GL_UNSIGNED_INT: if( isGL2ES2() ) { return true; } - case javax.media.opengl.GL2.GL_DOUBLE: + case javax.media.opengl.GL2GL3.GL_DOUBLE: if( isGL3() ) { return true; } @@ -1266,8 +1266,8 @@ public class GLProfile { return false; } - public boolean isValidArrayDataType(int index, int comps, int type, - boolean isVertexAttribPointer, boolean throwException) { + public boolean isValidArrayDataType(final int index, final int comps, final int type, + final boolean isVertexAttribPointer, final boolean throwException) { final String arrayName = getGLArrayName(index); if( isGLES1() ) { if(isVertexAttribPointer) { @@ -1391,8 +1391,8 @@ public class GLProfile { case GL.GL_SHORT: case GL.GL_FLOAT: case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2ES2.GL_UNSIGNED_INT: - case javax.media.opengl.GL2.GL_DOUBLE: + case GL.GL_UNSIGNED_INT: + case javax.media.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1420,7 +1420,7 @@ public class GLProfile { case GL.GL_SHORT: case GL.GL_FLOAT: case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2.GL_DOUBLE: + case javax.media.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1447,7 +1447,7 @@ public class GLProfile { case GL.GL_SHORT: case GL.GL_FLOAT: case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2.GL_DOUBLE: + case javax.media.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1474,8 +1474,8 @@ public class GLProfile { case GL.GL_SHORT: case GL.GL_FLOAT: case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2ES2.GL_UNSIGNED_INT: - case javax.media.opengl.GL2.GL_DOUBLE: + case GL.GL_UNSIGNED_INT: + case javax.media.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1500,7 +1500,7 @@ public class GLProfile { case GL.GL_SHORT: case GL.GL_FLOAT: case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2.GL_DOUBLE: + case javax.media.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1566,7 +1566,7 @@ public class GLProfile { private static final Constructor<?> getCtor(final String clazzName, final boolean glObject, final ClassLoader cl) { try { return ReflectionUtil.getConstructor(clazzName, glObject ? ctorGLArgs : ctorProcArgs, false, cl); - } catch (Throwable t) { + } catch (final Throwable t) { if( DEBUG ) { System.err.println("Caught: "+t.getMessage()); t.printStackTrace(); @@ -1656,16 +1656,16 @@ public class GLProfile { try { desktopFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getFactoryImpl(GL2); if(null != desktopFactory) { - DesktopGLDynamicLookupHelper glLookupHelper = (DesktopGLDynamicLookupHelper) desktopFactory.getGLDynamicLookupHelper(0); + final DesktopGLDynamicLookupHelper glLookupHelper = (DesktopGLDynamicLookupHelper) desktopFactory.getGLDynamicLookupHelper(0); if(null!=glLookupHelper) { hasDesktopGLFactory = glLookupHelper.isLibComplete() && hasGL234Impl; } } - } catch (LinkageError le) { + } catch (final LinkageError le) { t=le; - } catch (RuntimeException re) { + } catch (final RuntimeException re) { t=re; - } catch (Throwable tt) { + } catch (final Throwable tt) { t=tt; } if(DEBUG) { @@ -1696,13 +1696,13 @@ public class GLProfile { hasGLES3Impl = null!=eglFactory.getGLDynamicLookupHelper(2) && hasGLES3Impl; hasGLES1Impl = null!=eglFactory.getGLDynamicLookupHelper(1) && hasGLES1Impl; } - } catch (LinkageError le) { + } catch (final LinkageError le) { t=le; - } catch (SecurityException se) { + } catch (final SecurityException se) { t=se; - } catch (NullPointerException npe) { + } catch (final NullPointerException npe) { t=npe; - } catch (RuntimeException re) { + } catch (final RuntimeException re) { t=re; } if(DEBUG) { @@ -1765,13 +1765,13 @@ public class GLProfile { * @param device the device for which profiles shall be initialized * @return true if any profile for the device exists, otherwise false */ - private static boolean initProfilesForDevice(AbstractGraphicsDevice device) { + private static boolean initProfilesForDevice(final AbstractGraphicsDevice device) { if(null == device) { return false; } initLock.lock(); try { - GLDrawableFactory factory = GLDrawableFactory.getFactoryImpl(device); + final GLDrawableFactory factory = GLDrawableFactory.getFactoryImpl(device); factory.enterThreadCriticalZone(); try { return initProfilesForDeviceCritical(device); @@ -1782,8 +1782,8 @@ public class GLProfile { initLock.unlock(); } } - private static boolean initProfilesForDeviceCritical(AbstractGraphicsDevice device) { - boolean isSet = GLContext.getAvailableGLVersionsSet(device); + private static boolean initProfilesForDeviceCritical(final AbstractGraphicsDevice device) { + final boolean isSet = GLContext.getAvailableGLVersionsSet(device); if(DEBUG) { System.err.println("Info: GLProfile.initProfilesForDevice: "+device+" ("+device.getClass().getName()+"), isSet "+isSet+", hasDesktopGLFactory "+hasDesktopGLFactory+", hasEGLFactory "+hasEGLFactory); @@ -1791,7 +1791,7 @@ public class GLProfile { if(isSet) { // Avoid recursion and check whether impl. is sane! final String deviceKey = device.getUniqueID(); - HashMap<String /*GLProfile_name*/, GLProfile> map = deviceConn2ProfileMap.get(deviceKey); + final HashMap<String /*GLProfile_name*/, GLProfile> map = deviceConn2ProfileMap.get(deviceKey); if( null == map ) { throw new InternalError("GLContext Avail. GLVersion is set - but no profile map for device: "+device); } @@ -1813,7 +1813,7 @@ public class GLProfile { if(null != sharedResourceThread) { initLock.addOwner(sharedResourceThread); } - boolean desktopSharedCtxAvail = desktopFactory.createSharedResource(device); + final boolean desktopSharedCtxAvail = desktopFactory.createSharedResource(device); if(null != sharedResourceThread) { initLock.removeOwner(sharedResourceThread); } @@ -1841,7 +1841,7 @@ public class GLProfile { if(null != sharedResourceThread) { initLock.addOwner(sharedResourceThread); } - boolean eglSharedCtxAvail = eglFactory.createSharedResource(device); + final boolean eglSharedCtxAvail = eglFactory.createSharedResource(device); if(null != sharedResourceThread) { initLock.removeOwner(sharedResourceThread); } @@ -1881,13 +1881,13 @@ public class GLProfile { System.err.println("GLProfile.initProfilesForDevice: "+device.getConnection()+": "+glAvailabilityToString(device)); if(addedDesktopProfile) { dumpGLInfo(desktopFactory, device); - List<GLCapabilitiesImmutable> availCaps = desktopFactory.getAvailableCapabilities(device); + final List<GLCapabilitiesImmutable> availCaps = desktopFactory.getAvailableCapabilities(device); for(int i=0; i<availCaps.size(); i++) { System.err.println(availCaps.get(i)); } } else if(addedEGLProfile) { dumpGLInfo(eglFactory, device); - List<GLCapabilitiesImmutable> availCaps = eglFactory.getAvailableCapabilities(device); + final List<GLCapabilitiesImmutable> availCaps = eglFactory.getAvailableCapabilities(device); for(int i=0; i<availCaps.size(); i++) { System.err.println(availCaps.get(i)); } @@ -1897,8 +1897,8 @@ public class GLProfile { return addedDesktopProfile || addedEGLProfile; } - private static void dumpGLInfo(GLDrawableFactoryImpl factory, AbstractGraphicsDevice device) { - GLContext ctx = factory.getOrCreateSharedContext(device); + private static void dumpGLInfo(final GLDrawableFactoryImpl factory, final AbstractGraphicsDevice device) { + final GLContext ctx = factory.getOrCreateSharedContext(device); if(null != ctx) { System.err.println("GLProfile.dumpGLInfo: "+ctx); ctx.makeCurrent(); @@ -1917,8 +1917,8 @@ public class GLProfile { return defaultDevice; } - private static String array2String(String[] list) { - StringBuilder msg = new StringBuilder(); + private static String array2String(final String[] list) { + final StringBuilder msg = new StringBuilder(); msg.append("["); for (int i = 0; i < list.length; i++) { if (i > 0) @@ -1929,8 +1929,8 @@ public class GLProfile { return msg.toString(); } - private static void glAvailabilityToString(AbstractGraphicsDevice device, StringBuilder sb, int major, int profile) { - String str = GLContext.getAvailableGLVersionAsString(device, major, profile); + private static void glAvailabilityToString(final AbstractGraphicsDevice device, final StringBuilder sb, final int major, final int profile) { + final String str = GLContext.getAvailableGLVersionAsString(device, major, profile); if(null==str) { throw new GLException("Internal Error"); } @@ -1939,7 +1939,7 @@ public class GLProfile { sb.append("]"); } - private static boolean computeProfileMap(AbstractGraphicsDevice device, boolean desktopCtxUndef, boolean esCtxUndef) { + private static boolean computeProfileMap(final AbstractGraphicsDevice device, final boolean desktopCtxUndef, final boolean esCtxUndef) { if (DEBUG) { System.err.println("GLProfile.init map "+device.getConnection()+", desktopCtxUndef "+desktopCtxUndef+", esCtxUndef "+esCtxUndef); } @@ -1994,7 +1994,7 @@ public class GLProfile { /** * Returns the profile implementation */ - private static String computeProfileImpl(AbstractGraphicsDevice device, String profile, boolean desktopCtxUndef, boolean esCtxUndef, boolean isHardwareRasterizer[]) { + private static String computeProfileImpl(final AbstractGraphicsDevice device, final String profile, final boolean desktopCtxUndef, final boolean esCtxUndef, final boolean isHardwareRasterizer[]) { if (GL2ES1.equals(profile)) { final boolean es1HardwareRasterizer[] = new boolean[1]; final boolean gles1Available = hasGLES1Impl && ( esCtxUndef || GLContext.isGLES1Available(device, es1HardwareRasterizer) ); @@ -2143,7 +2143,7 @@ public class GLProfile { * @return the GLProfile HashMap if exists, otherwise null * @throws GLException if no profile for the given device is available. */ - private static HashMap<String /*GLProfile_name*/, GLProfile> getProfileMap(AbstractGraphicsDevice device, boolean throwExceptionOnZeroProfile) + private static HashMap<String /*GLProfile_name*/, GLProfile> getProfileMap(AbstractGraphicsDevice device, final boolean throwExceptionOnZeroProfile) throws GLException { initSingleton(); @@ -2175,13 +2175,13 @@ public class GLProfile { return map; } - private static void setProfileMap(AbstractGraphicsDevice device, HashMap<String /*GLProfile_name*/, GLProfile> mappedProfiles) { + private static void setProfileMap(final AbstractGraphicsDevice device, final HashMap<String /*GLProfile_name*/, GLProfile> mappedProfiles) { synchronized ( deviceConn2ProfileMap ) { deviceConn2ProfileMap.put(device.getUniqueID(), mappedProfiles); } } - private GLProfile(String profile, GLProfile profileImpl, boolean isHardwareRasterizer) { + private GLProfile(final String profile, final GLProfile profileImpl, final boolean isHardwareRasterizer) { this.profile = profile; this.profileImpl = profileImpl; this.isHardwareRasterizer = isHardwareRasterizer; diff --git a/src/jogl/classes/javax/media/opengl/GLUniformData.java b/src/jogl/classes/javax/media/opengl/GLUniformData.java index fac8b7a1f..67cc4c999 100644 --- a/src/jogl/classes/javax/media/opengl/GLUniformData.java +++ b/src/jogl/classes/javax/media/opengl/GLUniformData.java @@ -14,7 +14,7 @@ public class GLUniformData { * Number of objects is 1 * */ - public GLUniformData(String name, int val) { + public GLUniformData(final String name, final int val) { initScalar(name, 1, new Integer(val)); } @@ -24,7 +24,7 @@ public class GLUniformData { * Number of objects is 1 * */ - public GLUniformData(String name, float val) { + public GLUniformData(final String name, final float val) { initScalar(name, 1, new Float(val)); } @@ -35,7 +35,7 @@ public class GLUniformData { * * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4, */ - public GLUniformData(String name, int components, IntBuffer data) { + public GLUniformData(final String name, final int components, final IntBuffer data) { initBuffer(name, components, data); } @@ -46,19 +46,19 @@ public class GLUniformData { * * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4, */ - public GLUniformData(String name, int components, FloatBuffer data) { + public GLUniformData(final String name, final int components, final FloatBuffer data) { initBuffer(name, components, data); } - private GLUniformData(int components, String name) { + private GLUniformData(final int components, final String name) { initBuffer(name, components, null); } - public static GLUniformData creatEmptyVector(String name, int components) { + public static GLUniformData creatEmptyVector(final String name, final int components) { return new GLUniformData(components, name); } - public static GLUniformData creatEmptyMatrix(String name, int rows, int columns) { + public static GLUniformData creatEmptyMatrix(final String name, final int rows, final int columns) { return new GLUniformData(name, rows, columns, null); } @@ -70,7 +70,7 @@ public class GLUniformData { * @param rows the matrix rows * @param column the matrix column */ - public GLUniformData(String name, int rows, int columns, FloatBuffer data) { + public GLUniformData(final String name, final int rows, final int columns, final FloatBuffer data) { initBuffer(name, rows, columns, data); } @@ -114,7 +114,7 @@ public class GLUniformData { return toString(null).toString(); } - private void initBuffer(String name, int rows, int columns, Buffer buffer) { + private void initBuffer(final String name, final int rows, final int columns, final Buffer buffer) { if( 2>rows || rows>4 || 2>columns || columns>4 ) { throw new GLException("rowsXcolumns must be within [2..4]X[2..4], is: "+rows+"X"+columns); } @@ -125,7 +125,7 @@ public class GLUniformData { this.location=-1; initBuffer(buffer); } - private void initScalar(String name, int components, Object data) { + private void initScalar(final String name, final int components, final Object data) { if( 1>components || components>4 ) { throw new GLException("components must be within [1..4], is: "+components); } @@ -136,7 +136,7 @@ public class GLUniformData { this.location=-1; initScalar(data); } - private void initBuffer(String name, int components, Buffer buffer) { + private void initBuffer(final String name, final int components, final Buffer buffer) { if( 1>components || components>4 ) { throw new GLException("components must be within [1..4], is: "+components); } @@ -148,7 +148,7 @@ public class GLUniformData { initBuffer(buffer); } - private void initScalar(Object data) { + private void initScalar(final Object data) { if(data instanceof Buffer) { initBuffer((Buffer)data); } else if( null != data ) { @@ -185,7 +185,7 @@ public class GLUniformData { * Sets the given location of the shader uniform. * @return the given location */ - public int setLocation(int location) { this.location=location; return location; } + public int setLocation(final int location) { this.location=location; return location; } /** * Retrieves the location of the shader uniform from the linked shader program. @@ -197,7 +197,7 @@ public class GLUniformData { * @return ≥0 denotes a valid uniform location as found and used in the given shader program. * <0 denotes an invalid location, i.e. not found or used in the given shader program. */ - public int setLocation(GL2ES2 gl, int program) { + public int setLocation(final GL2ES2 gl, final int program) { location = gl.glGetUniformLocation(program, name); return location; } diff --git a/src/jogl/classes/javax/media/opengl/Threading.java b/src/jogl/classes/javax/media/opengl/Threading.java index 7503e9cf7..3ee233303 100644 --- a/src/jogl/classes/javax/media/opengl/Threading.java +++ b/src/jogl/classes/javax/media/opengl/Threading.java @@ -168,7 +168,7 @@ public class Threading { current thread is the OpenGL thread and either execute the Runnable directly or perform the work inside it. **/ - public static final void invokeOnOpenGLThread(boolean wait, Runnable r) throws GLException { + public static final void invokeOnOpenGLThread(final boolean wait, final Runnable r) throws GLException { ThreadingImpl.invokeOnOpenGLThread(wait, r); } @@ -185,7 +185,7 @@ public class Threading { * @param lock optional lock object to be tested * @throws GLException */ - public static final void invoke(boolean wait, Runnable r, Object lock) throws GLException { + public static final void invoke(final boolean wait, final Runnable r, final Object lock) throws GLException { if ( isSingleThreaded() && !isOpenGLThread() && ( null == lock || !Thread.holdsLock(lock) ) ) { invokeOnOpenGLThread(wait, r); diff --git a/src/jogl/classes/javax/media/opengl/TraceGL2.java b/src/jogl/classes/javax/media/opengl/TraceGL2.java index c577332e9..94d391d43 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL2.java +++ b/src/jogl/classes/javax/media/opengl/TraceGL2.java @@ -17,7 +17,7 @@ import java.io.PrintStream; * </p> */ public class TraceGL2 extends TraceGL4bc { - public TraceGL2(GL2 downstream, PrintStream stream) { + public TraceGL2(final GL2 downstream, final PrintStream stream) { super((GL4bc)downstream, stream); } } diff --git a/src/jogl/classes/javax/media/opengl/TraceGL3.java b/src/jogl/classes/javax/media/opengl/TraceGL3.java index 5fccf40c7..96e655902 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL3.java +++ b/src/jogl/classes/javax/media/opengl/TraceGL3.java @@ -17,7 +17,7 @@ import java.io.PrintStream; * </p> */ public class TraceGL3 extends TraceGL4bc { - public TraceGL3(GL3 downstream, PrintStream stream) { + public TraceGL3(final GL3 downstream, final PrintStream stream) { super((GL4bc)downstream, stream); } } diff --git a/src/jogl/classes/javax/media/opengl/TraceGL3bc.java b/src/jogl/classes/javax/media/opengl/TraceGL3bc.java index 84f537f60..2a8590236 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL3bc.java +++ b/src/jogl/classes/javax/media/opengl/TraceGL3bc.java @@ -17,7 +17,7 @@ import java.io.PrintStream; * </p> */ public class TraceGL3bc extends TraceGL4bc { - public TraceGL3bc(GL3bc downstream, PrintStream stream) { + public TraceGL3bc(final GL3bc downstream, final PrintStream stream) { super((GL4bc)downstream, stream); } } diff --git a/src/jogl/classes/javax/media/opengl/TraceGL4.java b/src/jogl/classes/javax/media/opengl/TraceGL4.java index afe2cd9a1..d48f9926a 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL4.java +++ b/src/jogl/classes/javax/media/opengl/TraceGL4.java @@ -17,7 +17,7 @@ import java.io.PrintStream; * </p> */ public class TraceGL4 extends TraceGL4bc { - public TraceGL4(GL4 downstream, PrintStream stream) { + public TraceGL4(final GL4 downstream, final PrintStream stream) { super((GL4bc)downstream, stream); } } diff --git a/src/jogl/classes/javax/media/opengl/TraceGLES2.java b/src/jogl/classes/javax/media/opengl/TraceGLES2.java index 4740e2e72..b58f169a7 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGLES2.java +++ b/src/jogl/classes/javax/media/opengl/TraceGLES2.java @@ -17,7 +17,7 @@ import java.io.PrintStream; * </p> */ public class TraceGLES2 extends TraceGLES3 { - public TraceGLES2(GLES2 downstream, PrintStream stream) { + public TraceGLES2(final GLES2 downstream, final PrintStream stream) { super((GLES3)downstream, stream); } } diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index e3a7838e7..9d2d21ce5 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -184,7 +184,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing private volatile boolean isShowing; private final HierarchyListener hierarchyListener = new HierarchyListener() { @Override - public void hierarchyChanged(HierarchyEvent e) { + public void hierarchyChanged(final HierarchyEvent e) { isShowing = GLCanvas.this.isShowing(); } }; @@ -212,7 +212,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. * @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, javax.media.opengl.GLContext, java.awt.GraphicsDevice) */ - public GLCanvas(GLCapabilitiesImmutable capsReqUser) throws GLException { + public GLCanvas(final GLCapabilitiesImmutable capsReqUser) throws GLException { this(capsReqUser, null, null, null); } @@ -226,7 +226,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing * @deprecated Use {@link #GLCanvas(GLCapabilitiesImmutable)} * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}. */ - public GLCanvas(GLCapabilitiesImmutable capsReqUser, GLContext shareWith) + public GLCanvas(final GLCapabilitiesImmutable capsReqUser, final GLContext shareWith) throws GLException { this(capsReqUser, null, shareWith, null); @@ -244,9 +244,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing is passed for this argument. * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. */ - public GLCanvas(GLCapabilitiesImmutable capsReqUser, - GLCapabilitiesChooser chooser, - GraphicsDevice device) + public GLCanvas(final GLCapabilitiesImmutable capsReqUser, + final GLCapabilitiesChooser chooser, + final GraphicsDevice device) throws GLException { this(capsReqUser, chooser, null, device); @@ -272,8 +272,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}. */ public GLCanvas(GLCapabilitiesImmutable capsReqUser, - GLCapabilitiesChooser chooser, - GLContext shareWith, + final GLCapabilitiesChooser chooser, + final GLContext shareWith, GraphicsDevice device) throws GLException { @@ -297,7 +297,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } if(null==device) { - GraphicsConfiguration gc = super.getGraphicsConfiguration(); + final GraphicsConfiguration gc = super.getGraphicsConfiguration(); if(null!=gc) { device = gc.getDevice(); } @@ -316,12 +316,12 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public final void setSharedContext(GLContext sharedContext) throws IllegalStateException { + public final void setSharedContext(final GLContext sharedContext) throws IllegalStateException { helper.setSharedContext(this.context, sharedContext); } @Override - public final void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { + public final void setSharedAutoDrawable(final GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { helper.setSharedAutoDrawable(this, sharedAutoDrawable); } @@ -331,7 +331,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public void setShallUseOffscreenLayer(boolean v) { + public void setShallUseOffscreenLayer(final boolean v) { shallUseOffscreenLayer = v; } @@ -410,11 +410,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing * block, both devices should have the same visual list, and the * same configuration should be selected here. */ - AWTGraphicsConfiguration config = chooseGraphicsConfiguration( (GLCapabilitiesImmutable)awtConfig.getChosenCapabilities(), + final AWTGraphicsConfiguration config = chooseGraphicsConfiguration( (GLCapabilitiesImmutable)awtConfig.getChosenCapabilities(), (GLCapabilitiesImmutable)awtConfig.getRequestedCapabilities(), chooser, gc.getDevice()); final GraphicsConfiguration compatible = (null!=config)?config.getAWTGraphicsConfiguration():null; - boolean equalCaps = config.getChosenCapabilities().equals(awtConfig.getChosenCapabilities()); + final boolean equalCaps = config.getChosenCapabilities().equals(awtConfig.getChosenCapabilities()); if(DEBUG) { System.err.println(getThreadName()+": Info:"); System.err.println("Created Config (n): HAVE GC "+chosen); @@ -487,7 +487,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } } - private final void setRealizedImpl(boolean realized) { + private final void setRealizedImpl(final boolean realized) { final RecursiveLock _lock = lock; _lock.lock(); try { @@ -514,7 +514,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing }; @Override - public final void setRealized(boolean realized) { + public final void setRealized(final boolean realized) { // Make sure drawable realization happens on AWT-EDT and only there. Consider the AWTTree lock! AWTEDTExecutor.singleton.invoke(getTreeLock(), false /* allowOnNonEDT */, true /* wait */, realized ? realizeOnEDTAction : unrealizeOnEDTAction); } @@ -531,7 +531,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) { + public WindowClosingMode setDefaultCloseOperation(final WindowClosingMode op) { return awtWindowClosingProtocol.setDefaultCloseOperation(op); } @@ -565,7 +565,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing destroyImpl( false ); } - protected void destroyImpl(boolean destroyJAWTWindowAndAWTDevice) { + protected void destroyImpl(final boolean destroyJAWTWindowAndAWTDevice) { Threading.invoke(true, destroyOnEDTAction, getTreeLock()); if( destroyJAWTWindowAndAWTDevice ) { AWTEDTExecutor.singleton.invoke(getTreeLock(), true /* allowOnNonEDT */, true /* wait */, disposeJAWTWindowAndAWTDeviceOnEDT); @@ -578,21 +578,21 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing properly. */ @Override - public void paint(Graphics g) { + public void paint(final Graphics g) { if( Beans.isDesignTime() ) { // Make GLCanvas behave better in NetBeans GUI builder g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); - FontMetrics fm = g.getFontMetrics(); + final FontMetrics fm = g.getFontMetrics(); String name = getName(); if (name == null) { name = getClass().getName(); - int idx = name.lastIndexOf('.'); + final int idx = name.lastIndexOf('.'); if (idx >= 0) { name = name.substring(idx + 1); } } - Rectangle2D bounds = fm.getStringBounds(name, g); + final Rectangle2D bounds = fm.getStringBounds(name, g); g.setColor(Color.WHITE); g.drawString(name, (int) ((getWidth() - bounds.getWidth()) / 2), @@ -801,7 +801,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing <DL><DD><CODE>reshape</CODE> in class <CODE>java.awt.Component</CODE></DD></DL> */ @SuppressWarnings("deprecation") @Override - public void reshape(int x, int y, int width, int height) { + public void reshape(final int x, final int y, final int width, final int height) { synchronized (getTreeLock()) { // super.reshape(..) claims tree lock, so we do extend it's lock over reshape super.reshape(x, y, width, height); reshapeImpl(width, height); @@ -845,7 +845,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing * canvas from interfering with the OpenGL rendering. */ @Override - public void update(Graphics g) { + public void update(final Graphics g) { paint(g); } @@ -855,7 +855,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing private AWTTilePainter printAWTTiles = null; @Override - public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) { + public void setupPrint(final double scaleMatX, final double scaleMatY, final int numSamples, final int tileWidth, final int tileHeight) { printActive = true; final int componentCount = isOpaque() ? 3 : 4; final TileRenderer printRenderer = new TileRenderer(); @@ -960,7 +960,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing }; @Override - public void print(Graphics graphics) { + public void print(final Graphics graphics) { if( !printActive || null == printGLAD ) { throw new IllegalStateException("setupPrint() not called"); } @@ -994,7 +994,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing printAWTTiles.resetGraphics2D(); } } - } catch (NoninvertibleTransformException nte) { + } catch (final NoninvertibleTransformException nte) { System.err.println("Caught: Inversion failed of: "+g2d.getTransform()); nte.printStackTrace(); } @@ -1004,12 +1004,12 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public void addGLEventListener(GLEventListener listener) { + public void addGLEventListener(final GLEventListener listener) { helper.addGLEventListener(listener); } @Override - public void addGLEventListener(int index, GLEventListener listener) throws IndexOutOfBoundsException { + public void addGLEventListener(final int index, final GLEventListener listener) throws IndexOutOfBoundsException { helper.addGLEventListener(index, listener); } @@ -1019,7 +1019,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException { + public GLEventListener getGLEventListener(final int index) throws IndexOutOfBoundsException { return helper.getGLEventListener(index); } @@ -1029,29 +1029,29 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public boolean getGLEventListenerInitState(GLEventListener listener) { + public boolean getGLEventListenerInitState(final GLEventListener listener) { return helper.getGLEventListenerInitState(listener); } @Override - public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) { + public void setGLEventListenerInitState(final GLEventListener listener, final boolean initialized) { helper.setGLEventListenerInitState(listener, initialized); } @Override - public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) { + public GLEventListener disposeGLEventListener(final GLEventListener listener, final boolean remove) { final DisposeGLEventListenerAction r = new DisposeGLEventListenerAction(listener, remove); Threading.invoke(true, r, getTreeLock()); return r.listener; } @Override - public GLEventListener removeGLEventListener(GLEventListener listener) { + public GLEventListener removeGLEventListener(final GLEventListener listener) { return helper.removeGLEventListener(listener); } @Override - public void setAnimator(GLAnimatorControl animatorControl) { + public void setAnimator(final GLAnimatorControl animatorControl) { helper.setAnimator(animatorControl); } @@ -1061,7 +1061,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public final Thread setExclusiveContextThread(Thread t) throws GLException { + public final Thread setExclusiveContextThread(final Thread t) throws GLException { return helper.setExclusiveContextThread(t, context); } @@ -1071,7 +1071,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public boolean invoke(boolean wait, GLRunnable glRunnable) { + public boolean invoke(final boolean wait, final GLRunnable glRunnable) { return helper.invoke(this, wait, glRunnable); } @@ -1081,7 +1081,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) { + public GLContext setContext(final GLContext newCtx, final boolean destroyPrevCtx) { final RecursiveLock _lock = lock; _lock.lock(); try { @@ -1114,7 +1114,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public GL setGL(GL gl) { + public GL setGL(final GL gl) { final GLContext _context = context; if (_context != null) { _context.setGL(gl); @@ -1125,7 +1125,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing @Override - public void setAutoSwapBufferMode(boolean onOrOff) { + public void setAutoSwapBufferMode(final boolean onOrOff) { helper.setAutoSwapBufferMode(onOrOff); } @@ -1140,7 +1140,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public void setContextCreationFlags(int flags) { + public void setContextCreationFlags(final int flags) { additionalCtxCreationFlags = flags; final GLContext _context = context; if(null != _context) { @@ -1263,7 +1263,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing if(DEBUG) { System.err.println(getThreadName()+": destroyOnEDTAction() - post ctx: "+context); } - } catch (GLException gle) { + } catch (final GLException gle) { gle.printStackTrace(); } } @@ -1327,7 +1327,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } else { adeviceMsg = null; } - boolean closed = adevice.close(); + final boolean closed = adevice.close(); if(DEBUG) { System.err.println(getThreadName()+": GLCanvas.disposeJAWTWindowAndAWTDeviceOnEDT(): post GraphicsDevice: "+adeviceMsg+", result: "+closed); } @@ -1393,7 +1393,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing private class DisposeGLEventListenerAction implements Runnable { GLEventListener listener; private final boolean remove; - private DisposeGLEventListenerAction(GLEventListener listener, boolean remove) { + private DisposeGLEventListenerAction(final GLEventListener listener, final boolean remove) { this.listener = listener; this.remove = remove; } @@ -1431,16 +1431,16 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing clazz.getDeclaredMethod("disableBackgroundErase", new Class[] { Canvas.class }); disableBackgroundEraseMethod.setAccessible(true); - } catch (Exception e) { + } catch (final Exception e) { clazz = clazz.getSuperclass(); } } - } catch (Exception e) { + } catch (final Exception e) { } return null; } }); - } catch (Exception e) { + } catch (final Exception e) { } disableBackgroundEraseInitialized = true; if(DEBUG) { @@ -1452,7 +1452,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing Throwable t=null; try { disableBackgroundEraseMethod.invoke(getToolkit(), new Object[] { this }); - } catch (Exception e) { + } catch (final Exception e) { t = e; } if(DEBUG) { @@ -1498,7 +1498,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing EventQueue.invokeAndWait(new Runnable() { @Override public void run() { - AWTGraphicsConfiguration c = (AWTGraphicsConfiguration) + final AWTGraphicsConfiguration c = (AWTGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class, GLCapabilitiesImmutable.class).chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, aScreen, VisualIDHolder.VID_UNDEFINED); @@ -1506,9 +1506,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } }); config = ( bucket.size() > 0 ) ? bucket.get(0) : null ; - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { throw new GLException(e); } } @@ -1525,7 +1525,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing /** * A most simple JOGL AWT test entry */ - public static void main(String args[]) { + public static void main(final String args[]) { System.err.println(VersionUtil.getPlatformInfo()); System.err.println(GlueGenVersion.getInstance()); // System.err.println(NativeWindowVersion.getInstance()); @@ -1542,16 +1542,16 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing glCanvas.addGLEventListener(new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); + public void init(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); System.err.println(JoglVersion.getGLInfo(gl, null)); } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { } + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } @Override - public void display(GLAutoDrawable drawable) { } + public void display(final GLAutoDrawable drawable) { } @Override - public void dispose(GLAutoDrawable drawable) { } + public void dispose(final GLAutoDrawable drawable) { } }); try { @@ -1560,7 +1560,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing public void run() { frame.setVisible(true); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); } glCanvas.display(); @@ -1570,7 +1570,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing public void run() { frame.dispose(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); } } diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 558970df6..eca99c6c0 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -96,6 +96,7 @@ import jogamp.opengl.awt.AWTTilePainter; import jogamp.opengl.awt.Java2D; import jogamp.opengl.util.glsl.GLSLTextureRaster; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.awt.AWTEDTExecutor; import com.jogamp.nativewindow.awt.AWTPrintLifecycle; import com.jogamp.nativewindow.awt.AWTWindowClosingProtocol; @@ -190,11 +191,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing static { Debug.initSingleton(); DEBUG = Debug.debug("GLJPanel"); - DEBUG_VIEWPORT = Debug.isPropertyDefined("jogl.debug.GLJPanel.Viewport", true); - USE_GLSL_TEXTURE_RASTERIZER = !Debug.isPropertyDefined("jogl.gljpanel.noglsl", true); - SKIP_VERTICAL_FLIP_DEFAULT = Debug.isPropertyDefined("jogl.gljpanel.noverticalflip", true); - boolean enabled = Debug.getBooleanProperty("sun.java2d.opengl", false); - java2dOGLEnabledByProp = enabled && !Debug.isPropertyDefined("jogl.gljpanel.noogl", true); + DEBUG_VIEWPORT = PropertyAccess.isPropertyDefined("jogl.debug.GLJPanel.Viewport", true); + USE_GLSL_TEXTURE_RASTERIZER = !PropertyAccess.isPropertyDefined("jogl.gljpanel.noglsl", true); + SKIP_VERTICAL_FLIP_DEFAULT = PropertyAccess.isPropertyDefined("jogl.gljpanel.noverticalflip", true); + boolean enabled = PropertyAccess.getBooleanProperty("sun.java2d.opengl", false); + java2dOGLEnabledByProp = enabled && !PropertyAccess.isPropertyDefined("jogl.gljpanel.noogl", true); enabled = false; if( java2dOGLEnabledByProp ) { @@ -281,7 +282,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private volatile boolean isShowing; private final HierarchyListener hierarchyListener = new HierarchyListener() { @Override - public void hierarchyChanged(HierarchyEvent e) { + public void hierarchyChanged(final HierarchyEvent e) { isShowing = GLJPanel.this.isShowing(); } }; @@ -308,7 +309,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing selection mechanism. * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. */ - public GLJPanel(GLCapabilitiesImmutable userCapsRequest) throws GLException { + public GLJPanel(final GLCapabilitiesImmutable userCapsRequest) throws GLException { this(userCapsRequest, null, null); } @@ -320,7 +321,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing is used if null is passed for this argument. * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. */ - public GLJPanel(GLCapabilitiesImmutable userCapsRequest, GLCapabilitiesChooser chooser) + public GLJPanel(final GLCapabilitiesImmutable userCapsRequest, final GLCapabilitiesChooser chooser) throws GLException { this(userCapsRequest, chooser, null); @@ -343,7 +344,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing * @deprecated Use {@link #GLJPanel(GLCapabilitiesImmutable, GLCapabilitiesChooser)} * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}. */ - public GLJPanel(GLCapabilitiesImmutable userCapsRequest, GLCapabilitiesChooser chooser, GLContext shareWith) + public GLJPanel(final GLCapabilitiesImmutable userCapsRequest, final GLCapabilitiesChooser chooser, final GLContext shareWith) throws GLException { super(); @@ -393,7 +394,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing * <p> * @param offthread */ - public final boolean initializeBackend(boolean offthread) { + public final boolean initializeBackend(final boolean offthread) { if( offthread ) { new Thread(getThreadName()+"-GLJPanel_Init") { public void run() { @@ -412,12 +413,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void setSharedContext(GLContext sharedContext) throws IllegalStateException { + public final void setSharedContext(final GLContext sharedContext) throws IllegalStateException { helper.setSharedContext(this.getContext(), sharedContext); } @Override - public final void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { + public final void setSharedAutoDrawable(final GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { helper.setSharedAutoDrawable(this, sharedAutoDrawable); } @@ -428,7 +429,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing * @throws IllegalArgumentException if <code>custom</code> is <code>null</code> * @throws IllegalStateException if backend is already realized, i.e. this instanced already painted once. */ - public void setPixelBufferProvider(AWTGLPixelBufferProvider custom) throws IllegalArgumentException, IllegalStateException { + public void setPixelBufferProvider(final AWTGLPixelBufferProvider custom) throws IllegalArgumentException, IllegalStateException { if( null == custom ) { throw new IllegalArgumentException("Null PixelBufferProvider"); } @@ -454,7 +455,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // so do everything on the event dispatch thread try { EventQueue.invokeAndWait(paintImmediatelyAction); - } catch (Exception e) { + } catch (final Exception e) { throw new GLException(e); } } @@ -469,7 +470,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if (backend != null && backend.getContext() != null) { boolean animatorPaused = false; - GLAnimatorControl animator = getAnimator(); + final GLAnimatorControl animator = getAnimator(); if(null!=animator) { animatorPaused = animator.pause(); } @@ -517,16 +518,16 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // Make GLJPanel behave better in NetBeans GUI builder g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); - FontMetrics fm = g.getFontMetrics(); + final FontMetrics fm = g.getFontMetrics(); String name = getName(); if (name == null) { name = getClass().getName(); - int idx = name.lastIndexOf('.'); + final int idx = name.lastIndexOf('.'); if (idx >= 0) { name = name.substring(idx + 1); } } - Rectangle2D bounds = fm.getStringBounds(name, g); + final Rectangle2D bounds = fm.getStringBounds(name, g); g.setColor(Color.WHITE); g.drawString(name, (int) ((getWidth() - bounds.getWidth()) / 2), @@ -647,7 +648,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing */ @SuppressWarnings("deprecation") @Override - public void reshape(int x, int y, int width, int height) { + public void reshape(final int x, final int y, final int width, final int height) { super.reshape(x, y, width, height); reshapeImpl(width, height); } @@ -675,7 +676,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private AWTTilePainter printAWTTiles = null; @Override - public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) { + public void setupPrint(final double scaleMatX, final double scaleMatY, final int numSamples, final int tileWidth, final int tileHeight) { printActive = true; final int componentCount = isOpaque() ? 3 : 4; final TileRenderer printRenderer = new TileRenderer(); @@ -802,7 +803,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing }; @Override - public void print(Graphics graphics) { + public void print(final Graphics graphics) { if( !printActive ) { throw new IllegalStateException("setupPrint() not called"); } @@ -837,7 +838,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing printAWTTiles.resetGraphics2D(); } } - } catch (NoninvertibleTransformException nte) { + } catch (final NoninvertibleTransformException nte) { System.err.println("Caught: Inversion failed of: "+g2d.getTransform()); nte.printStackTrace(); } @@ -846,7 +847,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } } @Override - protected void printComponent(Graphics g) { + protected void printComponent(final Graphics g) { if( DEBUG ) { System.err.println("AWT printComponent.X: "+printAWTTiles); } @@ -854,7 +855,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public void setOpaque(boolean opaque) { + public void setOpaque(final boolean opaque) { if (backend != null) { backend.setOpaque(opaque); } @@ -862,12 +863,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public void addGLEventListener(GLEventListener listener) { + public void addGLEventListener(final GLEventListener listener) { helper.addGLEventListener(listener); } @Override - public void addGLEventListener(int index, GLEventListener listener) { + public void addGLEventListener(final int index, final GLEventListener listener) { helper.addGLEventListener(index, listener); } @@ -877,7 +878,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException { + public GLEventListener getGLEventListener(final int index) throws IndexOutOfBoundsException { return helper.getGLEventListener(index); } @@ -887,17 +888,17 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public boolean getGLEventListenerInitState(GLEventListener listener) { + public boolean getGLEventListenerInitState(final GLEventListener listener) { return helper.getGLEventListenerInitState(listener); } @Override - public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) { + public void setGLEventListenerInitState(final GLEventListener listener, final boolean initialized) { helper.setGLEventListenerInitState(listener, initialized); } @Override - public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) { + public GLEventListener disposeGLEventListener(final GLEventListener listener, final boolean remove) { final DisposeGLEventListenerAction r = new DisposeGLEventListenerAction(listener, remove); if (EventQueue.isDispatchThread()) { r.run(); @@ -906,7 +907,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // so do everything on the event dispatch thread try { EventQueue.invokeAndWait(r); - } catch (Exception e) { + } catch (final Exception e) { throw new GLException(e); } } @@ -914,12 +915,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public GLEventListener removeGLEventListener(GLEventListener listener) { + public GLEventListener removeGLEventListener(final GLEventListener listener) { return helper.removeGLEventListener(listener); } @Override - public void setAnimator(GLAnimatorControl animatorControl) { + public void setAnimator(final GLAnimatorControl animatorControl) { helper.setAnimator(animatorControl); } @@ -929,7 +930,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final Thread setExclusiveContextThread(Thread t) throws GLException { + public final Thread setExclusiveContextThread(final Thread t) throws GLException { return helper.setExclusiveContextThread(t, getContext()); } @@ -939,7 +940,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public boolean invoke(boolean wait, GLRunnable glRunnable) { + public boolean invoke(final boolean wait, final GLRunnable glRunnable) { return helper.invoke(this, wait, glRunnable); } @@ -949,7 +950,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { final Backend b = backend; if ( null == b ) { return null; @@ -958,7 +959,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public void setRealized(boolean realized) { + public void setRealized(final boolean realized) { } @Override @@ -967,7 +968,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) { + public GLContext setContext(final GLContext newCtx, final boolean destroyPrevCtx) { final Backend b = backend; if ( null == b ) { return null; @@ -1002,13 +1003,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if (Beans.isDesignTime()) { return null; } - GLContext context = getContext(); + final GLContext context = getContext(); return (context == null) ? null : context.getGL(); } @Override - public GL setGL(GL gl) { - GLContext context = getContext(); + public GL setGL(final GL gl) { + final GLContext context = getContext(); if (context != null) { context.setGL(gl); return gl; @@ -1017,7 +1018,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public void setAutoSwapBufferMode(boolean enable) { + public void setAutoSwapBufferMode(final boolean enable) { this.autoSwapBufferMode = enable; boolean backendHandlesSwapBuffer = false; if( isInitialized ) { @@ -1047,7 +1048,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public void setContextCreationFlags(int flags) { + public void setContextCreationFlags(final int flags) { additionalCtxCreationFlags = flags; } @@ -1111,7 +1112,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing * See constraints of {@link #isGLOriented()}. * </p> */ - public final void setSkipGLOrientationVerticalFlip(boolean v) { + public final void setSkipGLOrientationVerticalFlip(final boolean v) { skipGLOrientationVerticalFlip = v; } /** See {@link #setSkipGLOrientationVerticalFlip(boolean)}. */ @@ -1186,7 +1187,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing * @param v requested texture unit * @see #getTextureUnit() */ - public final void setTextureUnit(int v) { + public final void setTextureUnit(final int v) { requestedTextureUnit = v; } @@ -1244,7 +1245,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) { + public WindowClosingMode setDefaultCloseOperation(final WindowClosingMode op) { return awtWindowClosingProtocol.setDefaultCloseOperation(op); } @@ -1265,12 +1266,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing class Updater implements GLEventListener { private Graphics g; - public void setGraphics(Graphics g) { + public void setGraphics(final Graphics g) { this.g = g; } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { if (!backend.preGL(g)) { return; } @@ -1279,12 +1280,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { helper.disposeAllGLEventListener(GLJPanel.this, false); } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { if (!backend.preGL(g)) { return; } @@ -1300,12 +1301,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing backend.postGL(g, true); } - public void plainPaint(GLAutoDrawable drawable) { + public void plainPaint(final GLAutoDrawable drawable) { helper.display(GLJPanel.this); } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { // This is handled above and dispatched directly to the appropriate context } } @@ -1329,7 +1330,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // so we can continue with the destruction. try { helper.disposeGL(GLJPanel.this, _context, !backendDestroy); - } catch (GLException gle) { + } catch (final GLException gle) { gle.printStackTrace(); } } @@ -1373,7 +1374,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private class DisposeGLEventListenerAction implements Runnable { GLEventListener listener; private final boolean remove; - private DisposeGLEventListenerAction(GLEventListener listener, boolean remove) { + private DisposeGLEventListenerAction(final GLEventListener listener, final boolean remove) { this.listener = listener; this.remove = remove; } @@ -1387,8 +1388,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } }; - private int getGLInteger(GL gl, int which) { - int[] tmp = new int[1]; + private int getGLInteger(final GL gl, final int which) { + final int[] tmp = new int[1]; gl.glGetIntegerv(which, tmp, 0); return tmp[0]; } @@ -1507,7 +1508,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // For saving/restoring of OpenGL state during ReadPixels private final GLPixelStorageModes psm = new GLPixelStorageModes(); - OffscreenBackend(GLProfile glp, AWTGLPixelBufferProvider custom) { + OffscreenBackend(final GLProfile glp, final AWTGLPixelBufferProvider custom) { if(null == custom) { pixelBufferProvider = getSingleAWTGLPixelBufferProvider(); } else { @@ -1543,7 +1544,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if( DEBUG ) { offscreenDrawable.getNativeSurface().addSurfaceUpdatedListener(new SurfaceUpdatedListener() { @Override - public final void surfaceUpdated(Object updater, NativeSurface ns, long when) { + public final void surfaceUpdated(final Object updater, final NativeSurface ns, final long when) { System.err.println(getThreadName()+": OffscreenBackend.swapBuffers - frameCount "+frameCount); } } ); } @@ -1577,7 +1578,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing glslTextureRaster = new GLSLTextureRaster(fboDrawable.getTextureUnit(), true); glslTextureRaster.init(gl.getGL2ES2()); glslTextureRaster.reshape(gl.getGL2ES2(), 0, 0, fboDrawable.getSurfaceWidth(), fboDrawable.getSurfaceHeight()); - } catch (Exception ex) { + } catch (final Exception ex) { ex.printStackTrace(); if(null != glslTextureRaster) { glslTextureRaster.dispose(gl.getGL2ES2()); @@ -1659,7 +1660,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void setOpaque(boolean opaque) { + public final void setOpaque(final boolean opaque) { if ( opaque != isOpaque() && !useSingletonBuffer ) { pixelBuffer.dispose(); pixelBuffer = null; @@ -1668,7 +1669,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final boolean preGL(Graphics g) { + public final boolean preGL(final Graphics g) { // Empty in this implementation return true; } @@ -1687,7 +1688,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void postGL(Graphics g, boolean isDisplay) { + public final void postGL(final Graphics g, final boolean isDisplay) { if (isDisplay) { if(DEBUG) { System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: - frameCount "+frameCount); @@ -1871,7 +1872,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void doPaintComponent(Graphics g) { + public final void doPaintComponent(final Graphics g) { helper.invokeGL(offscreenDrawable, offscreenContext, updaterDisplayAction, updaterInitAction); if ( null != alignedImage ) { @@ -1922,12 +1923,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final GLContext createContext(GLContext shareWith) { + public final GLContext createContext(final GLContext shareWith) { return (null != offscreenDrawable) ? offscreenDrawable.createContext(shareWith) : null; } @Override - public final void setContext(GLContext ctx) { + public final void setContext(final GLContext ctx) { offscreenContext=(GLContextImpl)ctx; } @@ -2041,12 +2042,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void setOpaque(boolean opaque) { + public final void setOpaque(final boolean opaque) { // Empty in this implementation } @Override - public final GLContext createContext(GLContext shareWith) { + public final GLContext createContext(final GLContext shareWith) { if(null != shareWith) { throw new GLException("J2DOGLBackend cannot create context w/ additional shared context, since it already needs to share the context w/ J2D."); } @@ -2054,7 +2055,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void setContext(GLContext ctx) { + public final void setContext(final GLContext ctx) { joglContext=ctx; } @@ -2090,11 +2091,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final boolean preGL(Graphics g) { + public final boolean preGL(final Graphics g) { final GL2 gl = joglContext.getGL().getGL2(); // Set up needed state in JOGL context from Java2D context - gl.glEnable(GL2.GL_SCISSOR_TEST); - Rectangle r = Java2D.getOGLScissorBox(g); + gl.glEnable(GL.GL_SCISSOR_TEST); + final Rectangle r = Java2D.getOGLScissorBox(g); if (r == null) { if (DEBUG) { @@ -2107,7 +2108,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } gl.glScissor(r.x, r.y, r.width, r.height); - Rectangle oglViewport = Java2D.getOGLViewport(g, panelWidth, panelHeight); + final Rectangle oglViewport = Java2D.getOGLViewport(g, panelWidth, panelHeight); // If the viewport X or Y changes, in addition to the panel's // width or height, we need to send a reshape operation to the // client @@ -2132,13 +2133,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // The texture target for Java2D's OpenGL pipeline when using FBOs // -- either GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB - int fboTextureTarget = Java2D.getOGLTextureType(g); + final int fboTextureTarget = Java2D.getOGLTextureType(g); if (!checkedForFBObjectWorkarounds) { checkedForFBObjectWorkarounds = true; gl.glBindTexture(fboTextureTarget, 0); - gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, frameBuffer[0]); - int status = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER); + gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, frameBuffer[0]); + final int status = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER); if (status != GL.GL_FRAMEBUFFER_COMPLETE) { // Need to do workarounds fbObjectWorkarounds = true; @@ -2168,10 +2169,10 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } gl.glBindTexture(fboTextureTarget, frameBufferTexture[0]); - int[] width = new int[1]; - int[] height = new int[1]; - gl.glGetTexLevelParameteriv(fboTextureTarget, 0, GL2.GL_TEXTURE_WIDTH, width, 0); - gl.glGetTexLevelParameteriv(fboTextureTarget, 0, GL2.GL_TEXTURE_HEIGHT, height, 0); + final int[] width = new int[1]; + final int[] height = new int[1]; + gl.glGetTexLevelParameteriv(fboTextureTarget, 0, GL2GL3.GL_TEXTURE_WIDTH, width, 0); + gl.glGetTexLevelParameteriv(fboTextureTarget, 0, GL2GL3.GL_TEXTURE_HEIGHT, height, 0); gl.glGenRenderbuffers(1, frameBufferDepthBuffer, 0); if (DEBUG) { @@ -2181,9 +2182,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, frameBufferDepthBuffer[0]); // FIXME: may need a loop here like in Java2D - gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, GL2GL3.GL_DEPTH_COMPONENT24, width[0], height[0]); + gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, GL.GL_DEPTH_COMPONENT24, width[0], height[0]); - gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, 0); + gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, 0); createNewDepthBuffer = false; } @@ -2207,7 +2208,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } if (DEBUG) { - int status = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER); + final int status = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER); if (status != GL.GL_FRAMEBUFFER_COMPLETE) { throw new GLException("Error: framebuffer was incomplete: status = 0x" + Integer.toHexString(status)); @@ -2240,11 +2241,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void postGL(Graphics g, boolean isDisplay) { + public final void postGL(final Graphics g, final boolean isDisplay) { // Cause OpenGL pipeline to flush its results because // otherwise it's possible we will buffer up multiple frames' // rendering results, resulting in apparent mouse lag - GL gl = joglContext.getGL(); + final GL gl = joglContext.getGL(); gl.glFinish(); if (Java2D.isFBOEnabled() && @@ -2308,7 +2309,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // FIXME: add more checks? j2dContext.makeCurrent(); - GL gl = j2dContext.getGL(); + final GL gl = j2dContext.getGL(); if ((getGLInteger(gl, GL.GL_RED_BITS) < offscreenCaps.getRedBits()) || (getGLInteger(gl, GL.GL_GREEN_BITS) < offscreenCaps.getGreenBits()) || (getGLInteger(gl, GL.GL_BLUE_BITS) < offscreenCaps.getBlueBits()) || @@ -2346,7 +2347,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } try { captureJ2DState(j2dContext.getGL(), g); - Object curSurface = Java2D.getOGLSurfaceIdentifier(g); + final Object curSurface = Java2D.getOGLSurfaceIdentifier(g); if (curSurface != null) { if (j2dSurface != curSurface) { if (joglContext != null) { @@ -2362,7 +2363,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing j2dSurface = curSurface; if (DEBUG) { System.err.print(getThreadName()+": Surface type: "); - int surfaceType = Java2D.getOGLSurfaceType(g); + final int surfaceType = Java2D.getOGLSurfaceType(g); if (surfaceType == Java2D.UNDEFINED) { System.err.println("UNDEFINED"); } else if (surfaceType == Java2D.WINDOW) { @@ -2381,7 +2382,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } } if (joglContext == null) { - AbstractGraphicsDevice device = j2dContext.getGLDrawable().getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); + final AbstractGraphicsDevice device = j2dContext.getGLDrawable().getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); if (factory.canCreateExternalGLDrawable(device)) { joglDrawable = factory.createExternalGLDrawable(); joglContext = joglDrawable.createContext(j2dContext); @@ -2410,9 +2411,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing helper.invokeGL(joglDrawable, joglContext, updaterPlainDisplayAction, updaterInitAction); } - private final void captureJ2DState(GL gl, Graphics g) { - gl.glGetIntegerv(GL2.GL_DRAW_BUFFER, drawBuffer, 0); - gl.glGetIntegerv(GL2.GL_READ_BUFFER, readBuffer, 0); + private final void captureJ2DState(final GL gl, final Graphics g) { + gl.glGetIntegerv(GL2GL3.GL_DRAW_BUFFER, drawBuffer, 0); + gl.glGetIntegerv(GL2ES3.GL_READ_BUFFER, readBuffer, 0); if (Java2D.isFBOEnabled() && Java2D.getOGLSurfaceType(g) == Java2D.FBOBJECT) { gl.glGetIntegerv(GL.GL_FRAMEBUFFER_BINDING, frameBuffer, 0); @@ -2446,7 +2447,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if (!checkedGLVendor) { checkedGLVendor = true; - String vendor = gl.glGetString(GL.GL_VENDOR); + final String vendor = gl.glGetString(GL.GL_VENDOR); if ((vendor != null) && vendor.startsWith("ATI")) { diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java b/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java index 9bd644223..3264062e8 100644 --- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java +++ b/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java @@ -39,7 +39,7 @@ public class GLPointerFuncUtil { * @param glArrayIndex the fixed function array index * @return default fixed function array name */ - public static String getPredefinedArrayIndexName(int glArrayIndex) { + public static String getPredefinedArrayIndexName(final int glArrayIndex) { return getPredefinedArrayIndexName(glArrayIndex, -1); } @@ -48,7 +48,7 @@ public class GLPointerFuncUtil { * @param multiTexCoordIndex index for multiTexCoordIndex * @return default fixed function array name */ - public static String getPredefinedArrayIndexName(int glArrayIndex, int multiTexCoordIndex) { + public static String getPredefinedArrayIndexName(final int glArrayIndex, final int multiTexCoordIndex) { switch(glArrayIndex) { case GLPointerFunc.GL_VERTEX_ARRAY: return mgl_Vertex; diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java b/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java index 15a7bb2a1..c293fbe18 100644 --- a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java +++ b/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java @@ -65,32 +65,32 @@ package javax.media.opengl.glu; public class GLUtessellatorCallbackAdapter implements GLUtessellatorCallback { @Override - public void begin(int type) {} + public void begin(final int type) {} @Override - public void edgeFlag(boolean boundaryEdge) {} + public void edgeFlag(final boolean boundaryEdge) {} @Override - public void vertex(Object vertexData) {} + public void vertex(final Object vertexData) {} @Override public void end() {} // public void mesh(jogamp.opengl.tessellator.GLUmesh mesh) {} @Override - public void error(int errnum) {} + public void error(final int errnum) {} @Override - public void combine(double[] coords, Object[] data, - float[] weight, Object[] outData) {} + public void combine(final double[] coords, final Object[] data, + final float[] weight, final Object[] outData) {} @Override - public void beginData(int type, Object polygonData) {} + public void beginData(final int type, final Object polygonData) {} @Override - public void edgeFlagData(boolean boundaryEdge, - Object polygonData) {} + public void edgeFlagData(final boolean boundaryEdge, + final Object polygonData) {} @Override - public void vertexData(Object vertexData, Object polygonData) {} + public void vertexData(final Object vertexData, final Object polygonData) {} @Override - public void endData(Object polygonData) {} + public void endData(final Object polygonData) {} @Override - public void errorData(int errnum, Object polygonData) {} + public void errorData(final int errnum, final Object polygonData) {} @Override - public void combineData(double[] coords, Object[] data, - float[] weight, Object[] outData, - Object polygonData) {} + public void combineData(final double[] coords, final Object[] data, + final float[] weight, final Object[] outData, + final Object polygonData) {} } |