codeanticode.glgraphics
Class GLSLShader

java.lang.Object
  extended by codeanticode.glgraphics.GLSLShader

public class GLSLShader
extends java.lang.Object

This class encapsulates a glsl shader. Based in the code by JohnG (http://www.hardcorepawn.com/)


Constructor Summary
GLSLShader(processing.core.PApplet parent)
          Creates an instance of GLSLShader.
 
Method Summary
 int getAttribLocation(java.lang.String name)
          Returns the ID location of the attribute parameter given its name.
 int getUniformLocation(java.lang.String name)
          Returns the ID location of the uniform parameter given its name.
 void linkProgram()
          Links the shader program and validates it.
 void loadFragmentShader(java.lang.String file)
          Loads and compiles the fragment shader contained in file.
 void loadGeometryShader(java.lang.String file)
          Loads and compiles the geometry shader contained in file.
 void loadVertexShader(java.lang.String file)
          Loads and compiles the vertex shader contained in file.
 void setupGeometryShader(java.lang.String inGeoPrim, java.lang.String outGeoPrim, int maxNumOutVert)
          Configures the geometry shader by setting the primitive types that it will take as input and return as output, and the maximum number of vertices that will generate.
 void start()
          Starts the execution of the shader program.
 void stop()
          Stops the execution of the shader program.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GLSLShader

public GLSLShader(processing.core.PApplet parent)
Creates an instance of GLSLShader.

Parameters:
parent - PApplet
Method Detail

loadVertexShader

public void loadVertexShader(java.lang.String file)
Loads and compiles the vertex shader contained in file.

Parameters:
file - String

loadGeometryShader

public void loadGeometryShader(java.lang.String file)
Loads and compiles the geometry shader contained in file.

Parameters:
file - String

loadFragmentShader

public void loadFragmentShader(java.lang.String file)
Loads and compiles the fragment shader contained in file.

Parameters:
file - String

getAttribLocation

public int getAttribLocation(java.lang.String name)
Returns the ID location of the attribute parameter given its name.

Parameters:
name - String
Returns:
int

getUniformLocation

public int getUniformLocation(java.lang.String name)
Returns the ID location of the uniform parameter given its name.

Parameters:
name - String
Returns:
int

setupGeometryShader

public void setupGeometryShader(java.lang.String inGeoPrim,
                                java.lang.String outGeoPrim,
                                int maxNumOutVert)
Configures the geometry shader by setting the primitive types that it will take as input and return as output, and the maximum number of vertices that will generate. This method needs to be called after creating the geometry shader and before linking the program.

Parameters:
inGeoPrim - String
outGeoPrim - String
maxNumOutVert - int

linkProgram

public void linkProgram()
Links the shader program and validates it.


start

public void start()
Starts the execution of the shader program.


stop

public void stop()
Stops the execution of the shader program.



processing library glgraphics by Andres Colubri. (c) 2008