OSDN Git Service

[fixed] graphics.glutils package javadoc
authorbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Sun, 7 Nov 2010 14:11:29 +0000 (14:11 +0000)
committerbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Sun, 7 Nov 2010 14:11:29 +0000 (14:11 +0000)
gdx/src/com/badlogic/gdx/graphics/glutils/FrameBuffer.java
gdx/src/com/badlogic/gdx/graphics/glutils/ShaderProgram.java

index 2336414..952ce96 100644 (file)
@@ -29,15 +29,21 @@ import com.badlogic.gdx.utils.GdxRuntimeException;
 \r
 /**\r
  * <p>\r
- * Encapsulates OpenGL ES 2.0 frame buffer objects. This is a simple helper class which should cover most FBO uses. It will\r
- * automatically create a texture for the color attachment and a renderbuffer for the depth buffer. You can get a hold of the\r
- * texture by {@link FrameBuffer#getColorBufferTexture()}. This class will only work with OpenGL ES 2.0.\r
+ * Encapsulates OpenGL ES 2.0 frame buffer objects. This is a simple helper\r
+ * class which should cover most FBO uses. It will automatically create a\r
+ * texture for the color attachment and a renderbuffer for the depth buffer. You\r
+ * can get a hold of the texture by {@link FrameBuffer#getColorBufferTexture()}.\r
+ * This class will only work with OpenGL ES 2.0.\r
  * </p>\r
  * \r
  * <p>\r
- * FrameBuffers can be managed. In case of an OpenGL context loss, which only happens on Android when a user switches to another\r
- * application or receives an incoming call, the framebuffer will be automatically recreated. This will essentially double the\r
- * size of the memory used so use this feature with care. Future versions will fix this and not eat up additional memory.\r
+ * FrameBuffers are managed. In case of an OpenGL context loss, which only\r
+ * happens on Android when a user switches to another application or receives an\r
+ * incoming call, the framebuffer will be automatically recreated.\r
+ * </p>\r
+ * \r
+ * <p>\r
+ * A FrameBuffer must be disposed if it is no longer needed\r
  * </p>\r
  * \r
  * @author mzechner\r
@@ -66,15 +72,22 @@ public class FrameBuffer {
        private final Pixmap.Format format;\r
 \r
        /**\r
-        * Creates a new FrameBuffer having the given dimensions and potentially a depth buffer attached.\r
+        * Creates a new FrameBuffer having the given dimensions and potentially a\r
+        * depth buffer attached.\r
         * \r
-        * @param format the format of the color buffer\r
-        * @param width the width of the framebuffer in pixels\r
-        * @param height the height of the framebuffer in pixels\r
-        * @param hasDepth whether to attach a depth buffer\r
-        * @throws GdxRuntimeException in case the FraeBuffer could not be created\r
+        * @param format\r
+        *            the format of the color buffer\r
+        * @param width\r
+        *            the width of the framebuffer in pixels\r
+        * @param height\r
+        *            the height of the framebuffer in pixels\r
+        * @param hasDepth\r
+        *            whether to attach a depth buffer\r
+        * @throws GdxRuntimeException\r
+        *             in case the FraeBuffer could not be created\r
         */\r
-       public FrameBuffer (Pixmap.Format format, int width, int height, boolean hasDepth) {\r
+       public FrameBuffer(Pixmap.Format format, int width, int height,\r
+                       boolean hasDepth) {\r
                this.width = width;\r
                this.height = height;\r
                this.format = format;\r
@@ -83,9 +96,10 @@ public class FrameBuffer {
                buffers.add(this);\r
        }\r
 \r
-       private void build () {\r
-               colorTexture = Gdx.graphics.newUnmanagedTexture(width, height, format, TextureFilter.Linear, TextureFilter.Linear,\r
-                       TextureWrap.ClampToEdge, TextureWrap.ClampToEdge);\r
+       private void build() {\r
+               colorTexture = Gdx.graphics.newUnmanagedTexture(width, height, format,\r
+                               TextureFilter.Linear, TextureFilter.Linear,\r
+                               TextureWrap.ClampToEdge, TextureWrap.ClampToEdge);\r
                GL20 gl = Gdx.graphics.getGL20();\r
 \r
                ByteBuffer tmp = ByteBuffer.allocateDirect(4);\r
@@ -98,14 +112,20 @@ public class FrameBuffer {
                gl.glGenRenderbuffers(1, handle);\r
                depthbufferHandle = handle.get(0);\r
 \r
-               gl.glBindTexture(GL20.GL_TEXTURE_2D, colorTexture.getTextureObjectHandle());\r
+               gl.glBindTexture(GL20.GL_TEXTURE_2D,\r
+                               colorTexture.getTextureObjectHandle());\r
                gl.glBindRenderbuffer(GL20.GL_RENDERBUFFER, depthbufferHandle);\r
-               gl.glRenderbufferStorage(GL20.GL_RENDERBUFFER, GL20.GL_DEPTH_COMPONENT16, colorTexture.getWidth(), colorTexture.getHeight());\r
+               gl.glRenderbufferStorage(GL20.GL_RENDERBUFFER,\r
+                               GL20.GL_DEPTH_COMPONENT16, colorTexture.getWidth(),\r
+                               colorTexture.getHeight());\r
 \r
                gl.glBindFramebuffer(GL20.GL_FRAMEBUFFER, framebufferHandle);\r
-               gl.glFramebufferTexture2D(GL20.GL_FRAMEBUFFER, GL20.GL_COLOR_ATTACHMENT0, GL20.GL_TEXTURE_2D,\r
-                       colorTexture.getTextureObjectHandle(), 0);\r
-               gl.glFramebufferRenderbuffer(GL20.GL_FRAMEBUFFER, GL20.GL_DEPTH_ATTACHMENT, GL20.GL_RENDERBUFFER, depthbufferHandle);\r
+               gl.glFramebufferTexture2D(GL20.GL_FRAMEBUFFER,\r
+                               GL20.GL_COLOR_ATTACHMENT0, GL20.GL_TEXTURE_2D,\r
+                               colorTexture.getTextureObjectHandle(), 0);\r
+               gl.glFramebufferRenderbuffer(GL20.GL_FRAMEBUFFER,\r
+                               GL20.GL_DEPTH_ATTACHMENT, GL20.GL_RENDERBUFFER,\r
+                               depthbufferHandle);\r
                int result = gl.glCheckFramebufferStatus(GL20.GL_FRAMEBUFFER);\r
 \r
                gl.glBindRenderbuffer(GL20.GL_RENDERBUFFER, 0);\r
@@ -123,18 +143,21 @@ public class FrameBuffer {
                        gl.glDeleteFramebuffers(1, handle);\r
 \r
                        if (result == GL20.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT)\r
-                               throw new IllegalStateException("frame buffer couldn't be constructed: incomplete attachment");\r
+                               throw new IllegalStateException(\r
+                                               "frame buffer couldn't be constructed: incomplete attachment");\r
                        if (result == GL20.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS)\r
-                               throw new IllegalStateException("frame buffer couldn't be constructed: incomplete dimensions");\r
+                               throw new IllegalStateException(\r
+                                               "frame buffer couldn't be constructed: incomplete dimensions");\r
                        if (result == GL20.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT)\r
-                               throw new IllegalStateException("frame buffer couldn't be constructed: missing attachment");\r
+                               throw new IllegalStateException(\r
+                                               "frame buffer couldn't be constructed: missing attachment");\r
                }\r
        }\r
 \r
        /**\r
         * Releases all resources associated with the FrameBuffer.\r
         */\r
-       public void dispose () {\r
+       public void dispose() {\r
                GL20 gl = Gdx.graphics.getGL20();\r
 \r
                ByteBuffer tmp = ByteBuffer.allocateDirect(4);\r
@@ -156,53 +179,59 @@ public class FrameBuffer {
        /**\r
         * Makes the frame buffer current so everything gets drawn to it.\r
         */\r
-       public void begin () {\r
-               Gdx.graphics.getGL20().glViewport(0, 0, colorTexture.getWidth(), colorTexture.getHeight());\r
-               Gdx.graphics.getGL20().glBindFramebuffer(GL20.GL_FRAMEBUFFER, framebufferHandle);\r
+       public void begin() {\r
+               Gdx.graphics.getGL20().glViewport(0, 0, colorTexture.getWidth(),\r
+                               colorTexture.getHeight());\r
+               Gdx.graphics.getGL20().glBindFramebuffer(GL20.GL_FRAMEBUFFER,\r
+                               framebufferHandle);\r
        }\r
 \r
        /**\r
-        * Unbinds the framebuffer, all drawing will be performed to the normal framebuffer from here on.\r
+        * Unbinds the framebuffer, all drawing will be performed to the normal\r
+        * framebuffer from here on.\r
         */\r
-       public void end () {\r
-               Gdx.graphics.getGL20().glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());\r
+       public void end() {\r
+               Gdx.graphics.getGL20().glViewport(0, 0, Gdx.graphics.getWidth(),\r
+                               Gdx.graphics.getHeight());\r
                Gdx.graphics.getGL20().glBindFramebuffer(GL20.GL_FRAMEBUFFER, 0);\r
        }\r
 \r
        /**\r
-        * Invalidates all frame buffers. This can be used when the OpenGL context is lost to rebuild all managed frame buffers. This\r
-        * assumes that the texture attached to this buffer has already been rebuild! Use with care.\r
+        * Invalidates all frame buffers. This can be used when the OpenGL context\r
+        * is lost to rebuild all managed frame buffers. This assumes that the\r
+        * texture attached to this buffer has already been rebuild! Use with care.\r
         */\r
-       public static void invalidateAllFrameBuffers () {\r
-               if (Gdx.graphics.getGL20() == null) return;\r
+       public static void invalidateAllFrameBuffers() {\r
+               if (Gdx.graphics.getGL20() == null)\r
+                       return;\r
 \r
                for (int i = 0; i < buffers.size(); i++) {\r
                        buffers.get(i).build();\r
                }\r
        }\r
 \r
-       public static void clearAllFrameBuffers () {\r
+       public static void clearAllFrameBuffers() {\r
                buffers.clear();\r
        }\r
 \r
        /**\r
         * @return the color buffer texture\r
         */\r
-       public Texture getColorBufferTexture () {\r
+       public Texture getColorBufferTexture() {\r
                return colorTexture;\r
        }\r
 \r
        /**\r
         * @return the height of the framebuffer in pixels\r
         */\r
-       public int getHeight () {\r
+       public int getHeight() {\r
                return colorTexture.getHeight();\r
        }\r
 \r
        /**\r
         * @return the width of the framebuffer in pixels\r
         */\r
-       public int getWidth () {\r
+       public int getWidth() {\r
                return colorTexture.getWidth();\r
        }\r
 }\r
index 784bac3..31a5574 100644 (file)
@@ -28,16 +28,19 @@ import com.badlogic.gdx.math.Matrix4;
 \r
 /**\r
  * <p>\r
- * A shader program encapsulates a vertex and fragment shader pair linked to form a shader program useable with OpenGL ES 2.0.\r
+ * A shader program encapsulates a vertex and fragment shader pair linked to\r
+ * form a shader program useable with OpenGL ES 2.0.\r
  * </p>\r
  * \r
  * <p>\r
- * After construction a ShaderProgram can be used to draw {@link Mesh} or sprites via a {@link SpriteBatch}. To make the GPU use\r
- * a specific ShaderProgram the programs {@link ShaderProgram#begin()} method must be used which effectively binds the program.\r
+ * After construction a ShaderProgram can be used to draw {@link Mesh}. To \r
+ * make the GPU use a specific ShaderProgram the programs {@link ShaderProgram#begin()} \r
+ * method must be used which effectively binds the program.\r
  * </p>\r
  * \r
  * <p>\r
- * When a ShaderProgram is bound one can set uniforms, vertex attributes and attributes as needed via the respective methods.\r
+ * When a ShaderProgram is bound one can set uniforms, vertex attributes and\r
+ * attributes as needed via the respective methods.\r
  * </p>\r
  * \r
  * <p>\r
@@ -45,13 +48,16 @@ import com.badlogic.gdx.math.Matrix4;
  * </p>\r
  * \r
  * <p>\r
- * A ShaderProgram must be disposed via a call to {@link ShaderProgram#dispose()} when it is no longer needed\r
+ * A ShaderProgram must be disposed via a call to\r
+ * {@link ShaderProgram#dispose()} when it is no longer needed\r
  * </p>\r
  * \r
  * <p>\r
- * ShaderPrograms are managed. In case the OpenGL context is lost all shaders get invalidated and have to be reloaded. This\r
- * happens on Android when a user switches to another application or receives an incoming call. Managed ShaderPrograms are\r
- * automatically reloaded when the OpenGL context is recreated so you don't have to do this manually.\r
+ * ShaderPrograms are managed. In case the OpenGL context is lost all shaders\r
+ * get invalidated and have to be reloaded. This happens on Android when a user\r
+ * switches to another application or receives an incoming call. Managed\r
+ * ShaderPrograms are automatically reloaded when the OpenGL context is\r
+ * recreated so you don't have to do this manually.\r
  * </p>\r
  * \r
  * @author mzechner\r
@@ -97,13 +103,18 @@ public class ShaderProgram {
        /**\r
         * Construcs a new JOglShaderProgram and immediatly compiles it.\r
         * \r
-        * @param vertexShader the vertex shader\r
-        * @param fragmentShader the fragment shader\r
+        * @param vertexShader\r
+        *            the vertex shader\r
+        * @param fragmentShader\r
+        *            the fragment shader\r
         */\r
 \r
-       public ShaderProgram (String vertexShader, String fragmentShader) {\r
-               if (vertexShader == null) throw new IllegalArgumentException("vertex shader must not be null");\r
-               if (fragmentShader == null) throw new IllegalArgumentException("fragment shader must not be null");\r
+       public ShaderProgram(String vertexShader, String fragmentShader) {\r
+               if (vertexShader == null)\r
+                       throw new IllegalArgumentException("vertex shader must not be null");\r
+               if (fragmentShader == null)\r
+                       throw new IllegalArgumentException(\r
+                                       "fragment shader must not be null");\r
 \r
                this.vertexShaderSource = vertexShader;\r
                this.fragmentShaderSource = fragmentShader;\r
@@ -117,13 +128,16 @@ public class ShaderProgram {
        }\r
 \r
        /**\r
-        * Loads and compiles the shaders, creates a new program and links the shaders.\r
+        * Loads and compiles the shaders, creates a new program and links the\r
+        * shaders.\r
+        * \r
         * @param vertexShader\r
         * @param fragmentShader\r
         */\r
-       private void compileShaders (String vertexShader, String fragmentShader) {\r
+       private void compileShaders(String vertexShader, String fragmentShader) {\r
                vertexShaderHandle = loadShader(GL20.GL_VERTEX_SHADER, vertexShader);\r
-               fragmentShaderHandle = loadShader(GL20.GL_FRAGMENT_SHADER, fragmentShader);\r
+               fragmentShaderHandle = loadShader(GL20.GL_FRAGMENT_SHADER,\r
+                               fragmentShader);\r
 \r
                if (vertexShaderHandle == -1 || fragmentShaderHandle == -1) {\r
                        isCompiled = false;\r
@@ -139,14 +153,15 @@ public class ShaderProgram {
                isCompiled = true;\r
        }\r
 \r
-       private int loadShader (int type, String source) {\r
+       private int loadShader(int type, String source) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                ByteBuffer tmp = ByteBuffer.allocateDirect(4);\r
                tmp.order(ByteOrder.nativeOrder());\r
                IntBuffer intbuf = tmp.asIntBuffer();\r
 \r
                int shader = gl.glCreateShader(type);\r
-               if (shader == 0) return -1;\r
+               if (shader == 0)\r
+                       return -1;\r
 \r
                gl.glShaderSource(shader, source);\r
                gl.glCompileShader(shader);\r
@@ -166,10 +181,11 @@ public class ShaderProgram {
                return shader;\r
        }\r
 \r
-       private int linkProgram () {\r
+       private int linkProgram() {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                int program = gl.glCreateProgram();\r
-               if (program == 0) return -1;\r
+               if (program == 0)\r
+                       return -1;\r
 \r
                gl.glAttachShader(program, vertexShaderHandle);\r
                gl.glAttachShader(program, fragmentShaderHandle);\r
@@ -184,7 +200,8 @@ public class ShaderProgram {
                if (linked == 0) {\r
                        gl.glGetProgramiv(program, GL20.GL_INFO_LOG_LENGTH, intbuf);\r
                        int infoLogLength = intbuf.get(0);\r
-                       if (infoLogLength > 1) log += gl.glGetProgramInfoLog(program);\r
+                       if (infoLogLength > 1)\r
+                               log += gl.glGetProgramInfoLog(program);\r
 \r
                        return -1;\r
                }\r
@@ -193,49 +210,56 @@ public class ShaderProgram {
        }\r
 \r
        /**\r
-        * @return the log info for the shader compilation and program linking stage. Returns an empty string if the shader program\r
-        *         compiled successfully.\r
+        * @return the log info for the shader compilation and program linking\r
+        *         stage. Returns an empty string if the shader program compiled\r
+        *         successfully.\r
         */\r
-       public String getLog () {\r
+       public String getLog() {\r
                return log;\r
        }\r
 \r
        /**\r
         * @return whether this ShaderProgram compiled successfully.\r
         */\r
-       public boolean isCompiled () {\r
+       public boolean isCompiled() {\r
                return isCompiled;\r
        }\r
 \r
-       private int fetchAttributeLocation (String name) {\r
+       private int fetchAttributeLocation(String name) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                Integer location;\r
                if ((location = attributes.get(name)) == null) {\r
                        location = gl.glGetAttribLocation(program, name);\r
-                       if (location != -1) attributes.put(name, location);\r
+                       if (location != -1)\r
+                               attributes.put(name, location);\r
                }\r
                return location;\r
        }\r
 \r
-       private int fetchUniformLocation (String name) {\r
+       private int fetchUniformLocation(String name) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                Integer location;\r
                if ((location = uniforms.get(name)) == null) {\r
                        location = gl.glGetUniformLocation(program, name);\r
-                       if (location == -1) throw new IllegalArgumentException("no uniform with name '" + name + "' in shader");\r
+                       if (location == -1)\r
+                               throw new IllegalArgumentException("no uniform with name '"\r
+                                               + name + "' in shader");\r
                        uniforms.put(name, location);\r
                }\r
                return location;\r
        }\r
 \r
        /**\r
-        * Sets the uniform with the given name. Throws an IllegalArgumentException in case it is not called in between a {@link\r
-        * #begin()}/{@link #end()} block.\r
+        * Sets the uniform with the given name. Throws an IllegalArgumentException\r
+        * in case it is not called in between a {@link #begin()}/{@link #end()}\r
+        * block.\r
         * \r
-        * @param name the name of the uniform\r
-        * @param value the value\r
+        * @param name\r
+        *            the name of the uniform\r
+        * @param value\r
+        *            the value\r
         */\r
-       public void setUniformi (String name, int value) {\r
+       public void setUniformi(String name, int value) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                checkManaged();\r
                int location = fetchUniformLocation(name);\r
@@ -243,14 +267,18 @@ public class ShaderProgram {
        }\r
 \r
        /**\r
-        * Sets the uniform with the given name. Throws an IllegalArgumentException in case it is not called in between a {@link\r
-        * #begin()}/{@link #end()} block.\r
+        * Sets the uniform with the given name. Throws an IllegalArgumentException\r
+        * in case it is not called in between a {@link #begin()}/{@link #end()}\r
+        * block.\r
         * \r
-        * @param name the name of the uniform\r
-        * @param value1 the first value\r
-        * @param value2 the second value\r
+        * @param name\r
+        *            the name of the uniform\r
+        * @param value1\r
+        *            the first value\r
+        * @param value2\r
+        *            the second value\r
         */\r
-       public void setUniformi (String name, int value1, int value2) {\r
+       public void setUniformi(String name, int value1, int value2) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                checkManaged();\r
                int location = fetchUniformLocation(name);\r
@@ -258,15 +286,20 @@ public class ShaderProgram {
        }\r
 \r
        /**\r
-        * Sets the uniform with the given name. Throws an IllegalArgumentException in case it is not called in between a {@link\r
-        * #begin()}/{@link #end()} block.\r
+        * Sets the uniform with the given name. Throws an IllegalArgumentException\r
+        * in case it is not called in between a {@link #begin()}/{@link #end()}\r
+        * block.\r
         * \r
-        * @param name the name of the uniform\r
-        * @param value1 the first value\r
-        * @param value2 the second value\r
-        * @param value3 the third value\r
+        * @param name\r
+        *            the name of the uniform\r
+        * @param value1\r
+        *            the first value\r
+        * @param value2\r
+        *            the second value\r
+        * @param value3\r
+        *            the third value\r
         */\r
-       public void setUniformi (String name, int value1, int value2, int value3) {\r
+       public void setUniformi(String name, int value1, int value2, int value3) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                checkManaged();\r
                int location = fetchUniformLocation(name);\r
@@ -274,16 +307,23 @@ public class ShaderProgram {
        }\r
 \r
        /**\r
-        * Sets the uniform with the given name. Throws an IllegalArgumentException in case it is not called in between a {@link\r
-        * #begin()}/{@link #end()} block.\r
+        * Sets the uniform with the given name. Throws an IllegalArgumentException\r
+        * in case it is not called in between a {@link #begin()}/{@link #end()}\r
+        * block.\r
         * \r
-        * @param name the name of the uniform\r
-        * @param value1 the first value\r
-        * @param value2 the second value\r
-        * @param value3 the third value\r
-        * @param value4 the fourth value\r
+        * @param name\r
+        *            the name of the uniform\r
+        * @param value1\r
+        *            the first value\r
+        * @param value2\r
+        *            the second value\r
+        * @param value3\r
+        *            the third value\r
+        * @param value4\r
+        *            the fourth value\r
         */\r
-       public void setUniformi (String name, int value1, int value2, int value3, int value4) {\r
+       public void setUniformi(String name, int value1, int value2, int value3,\r
+                       int value4) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                checkManaged();\r
                int location = fetchUniformLocation(name);\r
@@ -291,13 +331,16 @@ public class ShaderProgram {
        }\r
 \r
        /**\r
-        * Sets the uniform with the given name. Throws an IllegalArgumentException in case it is not called in between a {@link\r
-        * #begin()}/{@link #end()} block.\r
+        * Sets the uniform with the given name. Throws an IllegalArgumentException\r
+        * in case it is not called in between a {@link #begin()}/{@link #end()}\r
+        * block.\r
         * \r
-        * @param name the name of the uniform\r
-        * @param value the value\r
+        * @param name\r
+        *            the name of the uniform\r
+        * @param value\r
+        *            the value\r
         */\r
-       public void setUniformf (String name, float value) {\r
+       public void setUniformf(String name, float value) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                checkManaged();\r
                int location = fetchUniformLocation(name);\r
@@ -305,14 +348,18 @@ public class ShaderProgram {
        }\r
 \r
        /**\r
-        * Sets the uniform with the given name. Throws an IllegalArgumentException in case it is not called in between a {@link\r
-        * #begin()}/{@link #end()} block.\r
+        * Sets the uniform with the given name. Throws an IllegalArgumentException\r
+        * in case it is not called in between a {@link #begin()}/{@link #end()}\r
+        * block.\r
         * \r
-        * @param name the name of the uniform\r
-        * @param value1 the first value\r
-        * @param value2 the second value\r
+        * @param name\r
+        *            the name of the uniform\r
+        * @param value1\r
+        *            the first value\r
+        * @param value2\r
+        *            the second value\r
         */\r
-       public void setUniformf (String name, float value1, float value2) {\r
+       public void setUniformf(String name, float value1, float value2) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                checkManaged();\r
                int location = fetchUniformLocation(name);\r
@@ -320,15 +367,21 @@ public class ShaderProgram {
        }\r
 \r
        /**\r
-        * Sets the uniform with the given name. Throws an IllegalArgumentException in case it is not called in between a {@link\r
-        * #begin()}/{@link #end()} block.\r
+        * Sets the uniform with the given name. Throws an IllegalArgumentException\r
+        * in case it is not called in between a {@link #begin()}/{@link #end()}\r
+        * block.\r
         * \r
-        * @param name the name of the uniform\r
-        * @param value1 the first value\r
-        * @param value2 the second value\r
-        * @param value3 the third value\r
+        * @param name\r
+        *            the name of the uniform\r
+        * @param value1\r
+        *            the first value\r
+        * @param value2\r
+        *            the second value\r
+        * @param value3\r
+        *            the third value\r
         */\r
-       public void setUniformf (String name, float value1, float value2, float value3) {\r
+       public void setUniformf(String name, float value1, float value2,\r
+                       float value3) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                checkManaged();\r
                int location = fetchUniformLocation(name);\r
@@ -336,16 +389,23 @@ public class ShaderProgram {
        }\r
 \r
        /**\r
-        * Sets the uniform with the given name. Throws an IllegalArgumentException in case it is not called in between a {@link\r
-        * #begin()}/{@link #end()} block.\r
+        * Sets the uniform with the given name. Throws an IllegalArgumentException\r
+        * in case it is not called in between a {@link #begin()}/{@link #end()}\r
+        * block.\r
         * \r
-        * @param name the name of the uniform\r
-        * @param value1 the first value\r
-        * @param value2 the second value\r
-        * @param value3 the third value\r
-        * @param value4 the fourth value\r
+        * @param name\r
+        *            the name of the uniform\r
+        * @param value1\r
+        *            the first value\r
+        * @param value2\r
+        *            the second value\r
+        * @param value3\r
+        *            the third value\r
+        * @param value4\r
+        *            the fourth value\r
         */\r
-       public void setUniformf (String name, float value1, float value2, float value3, float value4) {\r
+       public void setUniformf(String name, float value1, float value2,\r
+                       float value3, float value4) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                checkManaged();\r
                int location = fetchUniformLocation(name);\r
@@ -353,12 +413,16 @@ public class ShaderProgram {
        }\r
 \r
        /**\r
-        * Sets the uniform matrix with the given name. Throws an IllegalArgumentException in case it is not called in between a\r
+        * Sets the uniform matrix with the given name. Throws an\r
+        * IllegalArgumentException in case it is not called in between a\r
         * {@link #begin()}/{@link #end()} block.\r
-        * @param name the name of the uniform\r
-        * @param matrix the matrix\r
+        * \r
+        * @param name\r
+        *            the name of the uniform\r
+        * @param matrix\r
+        *            the matrix\r
         */\r
-       public void setUniformMatrix (String name, Matrix4 matrix) {\r
+       public void setUniformMatrix(String name, Matrix4 matrix) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                checkManaged();\r
                int location = fetchUniformLocation(name);\r
@@ -368,67 +432,92 @@ public class ShaderProgram {
        }\r
 \r
        /**\r
-        * Sets the vertex attribute with the given name. Throws an IllegalArgumentException in case it is not called in between a\r
+        * Sets the vertex attribute with the given name. Throws an\r
+        * IllegalArgumentException in case it is not called in between a\r
         * {@link #begin()}/{@link #end()} block.\r
         * \r
-        * @param name the attribute name\r
-        * @param size the number of components, must be >= 1 and <= 4\r
-        * @param type the type, must be one of GL20.GL_BYTE, GL20.GL_UNSIGNED_BYTE, GL20.GL_SHORT,\r
-        *           GL20.GL_UNSIGNED_SHORT,GL20.GL_FIXED, or GL20.GL_FLOAT. GL_FIXED will not work on the desktop\r
-        * @param normalize whether fixed point data should be normalized. Will not work on the desktop\r
-        * @param stride the stride in bytes between successive attributes\r
-        * @param buffer the buffer containing the vertex attributes.\r
+        * @param name\r
+        *            the attribute name\r
+        * @param size\r
+        *            the number of components, must be >= 1 and <= 4\r
+        * @param type\r
+        *            the type, must be one of GL20.GL_BYTE, GL20.GL_UNSIGNED_BYTE,\r
+        *            GL20.GL_SHORT, GL20.GL_UNSIGNED_SHORT,GL20.GL_FIXED, or\r
+        *            GL20.GL_FLOAT. GL_FIXED will not work on the desktop\r
+        * @param normalize\r
+        *            whether fixed point data should be normalized. Will not work\r
+        *            on the desktop\r
+        * @param stride\r
+        *            the stride in bytes between successive attributes\r
+        * @param buffer\r
+        *            the buffer containing the vertex attributes.\r
         */\r
-       public void setVertexAttribute (String name, int size, int type, boolean normalize, int stride, FloatBuffer buffer) {\r
+       public void setVertexAttribute(String name, int size, int type,\r
+                       boolean normalize, int stride, FloatBuffer buffer) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                checkManaged();\r
                int location = fetchAttributeLocation(name);\r
-               gl.glVertexAttribPointer(location, size, type, normalize, stride, buffer);\r
+               gl.glVertexAttribPointer(location, size, type, normalize, stride,\r
+                               buffer);\r
        }\r
 \r
        /**\r
-        * Sets the vertex attribute with the given name. Throws an IllegalArgumentException in case it is not called in between a\r
+        * Sets the vertex attribute with the given name. Throws an\r
+        * IllegalArgumentException in case it is not called in between a\r
         * {@link #begin()}/{@link #end()} block.\r
         * \r
-        * @param name the attribute name\r
-        * @param size the number of components, must be >= 1 and <= 4\r
-        * @param type the type, must be one of GL20.GL_BYTE, GL20.GL_UNSIGNED_BYTE, GL20.GL_SHORT,\r
-        *           GL20.GL_UNSIGNED_SHORT,GL20.GL_FIXED, or GL20.GL_FLOAT. GL_FIXED will not work on the desktop\r
-        * @param normalize whether fixed point data should be normalized. Will not work on the desktop\r
-        * @param stride the stride in bytes between successive attributes\r
-        * @param offset byte offset into the vertex buffer object bound to GL20.GL_ARRAY_BUFFER.\r
+        * @param name\r
+        *            the attribute name\r
+        * @param size\r
+        *            the number of components, must be >= 1 and <= 4\r
+        * @param type\r
+        *            the type, must be one of GL20.GL_BYTE, GL20.GL_UNSIGNED_BYTE,\r
+        *            GL20.GL_SHORT, GL20.GL_UNSIGNED_SHORT,GL20.GL_FIXED, or\r
+        *            GL20.GL_FLOAT. GL_FIXED will not work on the desktop\r
+        * @param normalize\r
+        *            whether fixed point data should be normalized. Will not work\r
+        *            on the desktop\r
+        * @param stride\r
+        *            the stride in bytes between successive attributes\r
+        * @param offset\r
+        *            byte offset into the vertex buffer object bound to\r
+        *            GL20.GL_ARRAY_BUFFER.\r
         */\r
-       public void setVertexAttribute (String name, int size, int type, boolean normalize, int stride, int offset) {\r
+       public void setVertexAttribute(String name, int size, int type,\r
+                       boolean normalize, int stride, int offset) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                checkManaged();\r
                int location = fetchAttributeLocation(name);\r
-               if (location == -1) return;\r
-               gl.glVertexAttribPointer(location, size, type, normalize, stride, offset);\r
+               if (location == -1)\r
+                       return;\r
+               gl.glVertexAttribPointer(location, size, type, normalize, stride,\r
+                               offset);\r
        }\r
 \r
        /**\r
-        * Makes OpenGL ES 2.0 use this vertex and fragment shader pair. When you are done with this shader you have to call {@link\r
-        * ShaderProgram#end()}.\r
+        * Makes OpenGL ES 2.0 use this vertex and fragment shader pair. When you\r
+        * are done with this shader you have to call {@link ShaderProgram#end()}.\r
         */\r
-       public void begin () {\r
+       public void begin() {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                checkManaged();\r
                gl.glUseProgram(program);\r
        }\r
 \r
        /**\r
-        * Disables this shader. Must be called when one is done with the shader. Don't mix it with dispose, that will release the\r
-        * shader resources.\r
+        * Disables this shader. Must be called when one is done with the shader.\r
+        * Don't mix it with dispose, that will release the shader resources.\r
         */\r
-       public void end () {\r
+       public void end() {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                gl.glUseProgram(0);\r
        }\r
 \r
        /**\r
-        * Disposes all resources associated with this shader. Must be called when the shader is no longer used.\r
+        * Disposes all resources associated with this shader. Must be called when\r
+        * the shader is no longer used.\r
         */\r
-       public void dispose () {\r
+       public void dispose() {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                gl.glUseProgram(0);\r
                gl.glDeleteShader(vertexShaderHandle);\r
@@ -439,40 +528,48 @@ public class ShaderProgram {
 \r
        /**\r
         * Disables the vertex attribute with the given name\r
-        * @param name the vertex attribute name\r
+        * \r
+        * @param name\r
+        *            the vertex attribute name\r
         */\r
-       public void disableVertexAttribute (String name) {\r
+       public void disableVertexAttribute(String name) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                checkManaged();\r
                int location = fetchAttributeLocation(name);\r
-               if (location == -1) return;\r
+               if (location == -1)\r
+                       return;\r
                gl.glDisableVertexAttribArray(location);\r
        }\r
 \r
        /**\r
         * Enables the vertex attribute with the given name\r
-        * @param name the vertex attribute name\r
+        * \r
+        * @param name\r
+        *            the vertex attribute name\r
         */\r
-       public void enableVertexAttribute (String name) {\r
+       public void enableVertexAttribute(String name) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                checkManaged();\r
                int location = fetchAttributeLocation(name);\r
-               if (location == -1) return;\r
+               if (location == -1)\r
+                       return;\r
                gl.glEnableVertexAttribArray(location);\r
        }\r
 \r
-       private void checkManaged () {\r
+       private void checkManaged() {\r
                if (invalidated) {\r
                        compileShaders(vertexShaderSource, fragmentShaderSource);\r
                        invalidated = false;\r
-               }               \r
+               }\r
        }\r
 \r
        /**\r
-        * Invalidates all shaders so the next time they are used new handles are generated\r
+        * Invalidates all shaders so the next time they are used new handles are\r
+        * generated\r
         */\r
-       public static void invalidateAllShaderPrograms () {\r
-               if (Gdx.graphics.getGL20() == null) return;\r
+       public static void invalidateAllShaderPrograms() {\r
+               if (Gdx.graphics.getGL20() == null)\r
+                       return;\r
 \r
                for (int i = 0; i < shaders.size(); i++) {\r
                        shaders.get(i).invalidated = true;\r
@@ -480,20 +577,26 @@ public class ShaderProgram {
                }\r
        }\r
 \r
-       public static void clearAllShaderPrograms () {\r
+       public static void clearAllShaderPrograms() {\r
                shaders.clear();\r
        }\r
 \r
        /**\r
         * Sets the given attribute\r
         * \r
-        * @param name the name of the attribute\r
-        * @param value1 the first value\r
-        * @param value2 the second value\r
-        * @param value3 the third value\r
-        * @param value4 the fourth value\r
+        * @param name\r
+        *            the name of the attribute\r
+        * @param value1\r
+        *            the first value\r
+        * @param value2\r
+        *            the second value\r
+        * @param value3\r
+        *            the third value\r
+        * @param value4\r
+        *            the fourth value\r
         */\r
-       public void setAttributef (String name, float value1, float value2, float value3, float value4) {\r
+       public void setAttributef(String name, float value1, float value2,\r
+                       float value3, float value4) {\r
                GL20 gl = Gdx.graphics.getGL20();\r
                int location = fetchAttributeLocation(name);\r
                gl.glVertexAttrib4f(location, value1, value2, value3, value4);\r