From 556d92b63555a085b25e32b1cd55afce24edd07a Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Thu, 3 Jul 2014 16:21:36 +0200
Subject: 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
---
.../com/jogamp/opengl/util/glsl/ShaderUtil.java | 86 +++++++++++-----------
1 file changed, 43 insertions(+), 43 deletions(-)
(limited to 'src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java')
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
index ad5331a28..b927e8ceb 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
@@ -43,49 +43,49 @@ import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.GLExtensions;
public class ShaderUtil {
- public static String getShaderInfoLog(GL _gl, int shaderObj) {
+ public static String getShaderInfoLog(final GL _gl, final int shaderObj) {
final GL2ES2 gl = _gl.getGL2ES2();
- int[] infoLogLength=new int[1];
+ final int[] infoLogLength=new int[1];
gl.glGetShaderiv(shaderObj, GL2ES2.GL_INFO_LOG_LENGTH, infoLogLength, 0);
if(infoLogLength[0]==0) {
return "(no info log)";
}
- int[] charsWritten=new int[1];
- byte[] infoLogBytes = new byte[infoLogLength[0]];
+ final int[] charsWritten=new int[1];
+ final byte[] infoLogBytes = new byte[infoLogLength[0]];
gl.glGetShaderInfoLog(shaderObj, infoLogLength[0], charsWritten, 0, infoLogBytes, 0);
return new String(infoLogBytes, 0, charsWritten[0]);
}
- public static String getProgramInfoLog(GL _gl, int programObj) {
+ public static String getProgramInfoLog(final GL _gl, final int programObj) {
final GL2ES2 gl = _gl.getGL2ES2();
- int[] infoLogLength=new int[1];
+ final int[] infoLogLength=new int[1];
gl.glGetProgramiv(programObj, GL2ES2.GL_INFO_LOG_LENGTH, infoLogLength, 0);
if(infoLogLength[0]==0) {
return "(no info log)";
}
- int[] charsWritten=new int[1];
- byte[] infoLogBytes = new byte[infoLogLength[0]];
+ final int[] charsWritten=new int[1];
+ final byte[] infoLogBytes = new byte[infoLogLength[0]];
gl.glGetProgramInfoLog(programObj, infoLogLength[0], charsWritten, 0, infoLogBytes, 0);
return new String(infoLogBytes, 0, charsWritten[0]);
}
- public static boolean isShaderStatusValid(GL _gl, int shaderObj, int name, PrintStream verboseOut) {
+ public static boolean isShaderStatusValid(final GL _gl, final int shaderObj, final int name, final PrintStream verboseOut) {
final GL2ES2 gl = _gl.getGL2ES2();
- int[] ires = new int[1];
+ final int[] ires = new int[1];
gl.glGetShaderiv(shaderObj, name, ires, 0);
- boolean res = ires[0]==1;
+ final boolean res = ires[0]==1;
if(!res && null!=verboseOut) {
verboseOut.println("Shader status invalid: "+ getShaderInfoLog(gl, shaderObj));
}
return res;
}
- public static boolean isShaderStatusValid(GL _gl, IntBuffer shaders, int name, PrintStream verboseOut) {
+ public static boolean isShaderStatusValid(final GL _gl, final IntBuffer shaders, final int name, final PrintStream verboseOut) {
boolean res = true;
for (int i = shaders.position(); i < shaders.limit(); i++) {
res = isShaderStatusValid(_gl, shaders.get(i), name, verboseOut) && res;
@@ -93,15 +93,15 @@ public class ShaderUtil {
return res;
}
- public static boolean isProgramStatusValid(GL _gl, int programObj, int name) {
+ public static boolean isProgramStatusValid(final GL _gl, final int programObj, final int name) {
final GL2ES2 gl = _gl.getGL2ES2();
- int[] ires = new int[1];
+ final int[] ires = new int[1];
gl.glGetProgramiv(programObj, name, ires, 0);
return ires[0]==1;
}
- public static boolean isProgramLinkStatusValid(GL _gl, int programObj, PrintStream verboseOut) {
+ public static boolean isProgramLinkStatusValid(final GL _gl, final int programObj, final PrintStream verboseOut) {
final GL2ES2 gl = _gl.getGL2ES2();
if(!gl.glIsProgram(programObj)) {
if(null!=verboseOut) {
@@ -130,7 +130,7 @@ public class ShaderUtil {
*
* @see GL2ES2#glValidateProgram(int)
**/
- public static boolean isProgramExecStatusValid(GL _gl, int programObj, PrintStream verboseOut) {
+ public static boolean isProgramExecStatusValid(final GL _gl, final int programObj, final PrintStream verboseOut) {
final GL2ES2 gl = _gl.getGL2ES2();
gl.glValidateProgram(programObj);
if(!isProgramStatusValid(gl, programObj, GL2ES2.GL_VALIDATE_STATUS)) {
@@ -142,7 +142,7 @@ public class ShaderUtil {
return true;
}
- public static void createShader(GL _gl, int type, IntBuffer shaders) {
+ public static void createShader(final GL _gl, final int type, final IntBuffer shaders) {
final GL2ES2 gl = _gl.getGL2ES2();
for (int i = shaders.position(); i < shaders.limit(); i++) {
shaders.put(i, gl.glCreateShader(type));
@@ -154,7 +154,7 @@ public class ShaderUtil {
* {@link GL2ES2#GL_NUM_SHADER_BINARY_FORMATS} and {@link GL2ES2#GL_SHADER_BINARY_FORMATS}
* via {@link GL2ES2#glGetIntegerv(int, int[], int)}.
*/
- public static Set getShaderBinaryFormats(GL _gl) {
+ public static Set getShaderBinaryFormats(final GL _gl) {
final GL2ES2 gl = _gl.getGL2ES2();
final ProfileInformation info = getProfileInformation(gl);
if(null == info.shaderBinaryFormats) {
@@ -166,13 +166,13 @@ public class ShaderUtil {
final int err = gl.glGetError();
final int numFormats = GL.GL_NO_ERROR == err ? param[0] : 0;
if(numFormats>0) {
- int[] formats = new int[numFormats];
+ final int[] formats = new int[numFormats];
gl.glGetIntegerv(GL2ES2.GL_SHADER_BINARY_FORMATS, formats, 0);
for(int i=0; i= 0 ||
ctx.isExtensionAvailable(GLExtensions.ARB_geometry_shader4);
}
- public static void shaderSource(GL _gl, int shader, CharSequence[] source)
+ public static void shaderSource(final GL _gl, final int shader, final CharSequence[] source)
{
final GL2ES2 gl = _gl.getGL2ES2();
if(!isShaderCompilerAvailable(_gl)) {
throw new GLException("No compiler is available");
}
- int count = (null!=source)?source.length:0;
+ final int count = (null!=source)?source.length:0;
if(count==0) {
throw new GLException("No sources specified");
}
- IntBuffer lengths = Buffers.newDirectIntBuffer(count);
+ final IntBuffer lengths = Buffers.newDirectIntBuffer(count);
for(int i=0; i=binLength) {
throw new GLException("Empty shader binary (remaining == 0)");
}
gl.glShaderBinary(shaderNum, shaders, binFormat, bin, binLength);
}
- public static void compileShader(GL _gl, IntBuffer shaders)
+ public static void compileShader(final GL _gl, final IntBuffer shaders)
{
final GL2ES2 gl = _gl.getGL2ES2();
for (int i = shaders.position(); i < shaders.limit(); i++) {
@@ -302,7 +302,7 @@ public class ShaderUtil {
}
}
- public static void attachShader(GL _gl, int program, IntBuffer shaders)
+ public static void attachShader(final GL _gl, final int program, final IntBuffer shaders)
{
final GL2ES2 gl = _gl.getGL2ES2();
for (int i = shaders.position(); i < shaders.limit(); i++) {
@@ -310,7 +310,7 @@ public class ShaderUtil {
}
}
- public static void detachShader(GL _gl, int program, IntBuffer shaders)
+ public static void detachShader(final GL _gl, final int program, final IntBuffer shaders)
{
final GL2ES2 gl = _gl.getGL2ES2();
for (int i = shaders.position(); i < shaders.limit(); i++) {
@@ -318,7 +318,7 @@ public class ShaderUtil {
}
}
- public static void deleteShader(GL _gl, IntBuffer shaders)
+ public static void deleteShader(final GL _gl, final IntBuffer shaders)
{
final GL2ES2 gl = _gl.getGL2ES2();
for (int i = shaders.position(); i < shaders.limit(); i++) {
@@ -327,9 +327,9 @@ public class ShaderUtil {
}
}
- public static boolean createAndLoadShader(GL _gl, IntBuffer shader, int shaderType,
- int binFormat, java.nio.Buffer bin,
- PrintStream verboseOut)
+ public static boolean createAndLoadShader(final GL _gl, final IntBuffer shader, final int shaderType,
+ final int binFormat, final java.nio.Buffer bin,
+ final PrintStream verboseOut)
{
final GL2ES2 gl = _gl.getGL2ES2();
int err = gl.glGetError(); // flush previous errors ..
@@ -352,9 +352,9 @@ public class ShaderUtil {
return err == GL.GL_NO_ERROR;
}
- public static boolean createAndCompileShader(GL _gl, IntBuffer shader, int shaderType,
- CharSequence[][] sources,
- PrintStream verboseOut)
+ public static boolean createAndCompileShader(final GL _gl, final IntBuffer shader, final int shaderType,
+ final CharSequence[][] sources,
+ final PrintStream verboseOut)
{
final GL2ES2 gl = _gl.getGL2ES2();
int err = gl.glGetError(); // flush previous errors ..
@@ -390,7 +390,7 @@ public class ShaderUtil {
Set shaderBinaryFormats = null;
}
- private static ProfileInformation getProfileInformation(GL gl) {
+ private static ProfileInformation getProfileInformation(final GL gl) {
final GLContext context = gl.getContext();
context.validateCurrent();
ProfileInformation data = (ProfileInformation) context.getAttachedObject(implObjectKey);
--
cgit v1.2.3