aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
diff options
context:
space:
mode:
authorSven Gothel <sgothel@jausoft.com>2014-07-03 16:21:36 +0200
committerSven Gothel <sgothel@jausoft.com>2014-07-03 16:21:36 +0200
commit556d92b63555a085b25e32b1cd55afce24edd07a (patch)
tree6be2b02c62a77d5aba81ffbe34c46960608be163 /src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
parenta90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
index 3ac17b0c5..a9b0bddc6 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
@@ -65,7 +65,7 @@ public class ShaderProgram {
*
* @see #release(GL2ES2, boolean)
*/
- public synchronized void destroy(GL2ES2 gl) {
+ public synchronized void destroy(final GL2ES2 gl) {
release(gl, true);
}
@@ -76,7 +76,7 @@ public class ShaderProgram {
*
* @see #release(GL2ES2, boolean)
*/
- public synchronized void release(GL2ES2 gl) {
+ public synchronized void release(final GL2ES2 gl) {
release(gl, false);
}
@@ -84,12 +84,12 @@ public class ShaderProgram {
* Detaches all shader codes and deletes the program.
* If <code>destroyShaderCode</code> is true it destroys the shader codes as well.
*/
- public synchronized void release(GL2ES2 gl, boolean destroyShaderCode) {
+ public synchronized void release(final GL2ES2 gl, final boolean destroyShaderCode) {
if( programLinked ) {
useProgram(gl, false);
}
- for(Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) {
- ShaderCode shaderCode = iter.next();
+ for(final Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) {
+ final ShaderCode shaderCode = iter.next();
if(attachedShaderCode.remove(shaderCode)) {
ShaderUtil.detachShader(gl, shaderProgram, shaderCode.shader());
}
@@ -115,11 +115,11 @@ public class ShaderProgram {
* <p>This command does not compile and attach the shader,
* use {@link #add(GL2ES2, ShaderCode)} for this purpose.</p>
*/
- public synchronized void add(ShaderCode shaderCode) throws GLException {
+ public synchronized void add(final ShaderCode shaderCode) throws GLException {
allShaderCode.add(shaderCode);
}
- public synchronized boolean contains(ShaderCode shaderCode) {
+ public synchronized boolean contains(final ShaderCode shaderCode) {
return allShaderCode.contains(shaderCode);
}
@@ -128,9 +128,9 @@ public class ShaderProgram {
* @param id
* @return
*/
- public synchronized ShaderCode getShader(int id) {
- for(Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) {
- ShaderCode shaderCode = iter.next();
+ public synchronized ShaderCode getShader(final int id) {
+ for(final Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) {
+ final ShaderCode shaderCode = iter.next();
if(shaderCode.id() == id) {
return shaderCode;
}
@@ -149,7 +149,7 @@ public class ShaderProgram {
* @param gl
* @return true if shader program is valid, i.e. not zero
*/
- public synchronized final boolean init(GL2ES2 gl) {
+ public synchronized final boolean init(final GL2ES2 gl) {
if( 0 == shaderProgram ) {
shaderProgram = gl.glCreateProgram();
}
@@ -163,7 +163,7 @@ public class ShaderProgram {
*
* @return true if the shader was successfully added, false if compilation failed.
*/
- public synchronized boolean add(GL2ES2 gl, ShaderCode shaderCode, PrintStream verboseOut) {
+ public synchronized boolean add(final GL2ES2 gl, final ShaderCode shaderCode, final PrintStream verboseOut) {
if( !init(gl) ) { return false; }
if( allShaderCode.add(shaderCode) ) {
if( !shaderCode.compile(gl, verboseOut) ) {
@@ -195,12 +195,12 @@ public class ShaderProgram {
* @see ShaderState#glResetAllVertexAttributes
* @see ShaderState#glResetAllVertexAttributes
*/
- public synchronized boolean replaceShader(GL2ES2 gl, ShaderCode oldShader, ShaderCode newShader, PrintStream verboseOut) {
+ public synchronized boolean replaceShader(final GL2ES2 gl, final ShaderCode oldShader, final ShaderCode newShader, final PrintStream verboseOut) {
if(!init(gl) || !newShader.compile(gl, verboseOut)) {
return false;
}
- boolean shaderWasInUse = inUse();
+ final boolean shaderWasInUse = inUse();
if(shaderWasInUse) {
useProgram(gl, false);
}
@@ -238,13 +238,13 @@ public class ShaderProgram {
*
* @see #init(GL2ES2)
*/
- public synchronized boolean link(GL2ES2 gl, PrintStream verboseOut) {
+ public synchronized boolean link(final GL2ES2 gl, final PrintStream verboseOut) {
if( !init(gl) ) {
programLinked = false; // mark unlinked due to user attempt to [re]link
return false;
}
- for(Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) {
+ for(final Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) {
final ShaderCode shaderCode = iter.next();
if(!shaderCode.compile(gl, verboseOut)) {
programLinked = false; // mark unlinked due to user attempt to [re]link
@@ -264,7 +264,7 @@ public class ShaderProgram {
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if(this == obj) { return true; }
if(obj instanceof ShaderProgram) {
return id()==((ShaderProgram)obj).id();
@@ -283,7 +283,7 @@ public class ShaderProgram {
}
sb.append("ShaderProgram[id=").append(id);
sb.append(", linked="+programLinked+", inUse="+programInUse+", program: "+shaderProgram+",");
- for(Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) {
+ for(final Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) {
sb.append(Platform.getNewline()).append(" ").append(iter.next());
}
sb.append("]");
@@ -299,11 +299,11 @@ public class ShaderProgram {
* Performs {@link GL2ES2#glValidateProgram(int)} via {@link ShaderUtil#isProgramExecStatusValid(GL, int, PrintStream)}.
* @see ShaderUtil#isProgramExecStatusValid(GL, int, PrintStream)
**/
- public synchronized boolean validateProgram(GL2ES2 gl, PrintStream verboseOut) {
+ public synchronized boolean validateProgram(final GL2ES2 gl, final PrintStream verboseOut) {
return ShaderUtil.isProgramExecStatusValid(gl, shaderProgram, verboseOut);
}
- public synchronized void useProgram(GL2ES2 gl, boolean on) {
+ public synchronized void useProgram(final GL2ES2 gl, boolean on) {
if(!programLinked) { throw new GLException("Program is not linked"); }
if(programInUse==on) { return; }
if( 0 == shaderProgram ) {