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/)


Field Summary
protected  int fragmentShader
           
protected  GL gl
           
protected  processing.core.PApplet parent
           
protected  PGraphicsOpenGL pgl
           
protected  int programObject
           
protected  int vertexShader
           
 
Constructor Summary
GLSLShader(processing.core.PApplet parent)
          Creates an instance of GLSLShader.
 
Method Summary
protected  void checkLogInfo(java.lang.String title, int obj)
           
 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 loadVertexShader(java.lang.String file)
          Loads and compiles the vertex shader contained in file.
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected processing.core.PApplet parent

gl

protected GL gl

pgl

protected PGraphicsOpenGL pgl

programObject

protected int programObject

vertexShader

protected int vertexShader

fragmentShader

protected int fragmentShader
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

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

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.


checkLogInfo

protected void checkLogInfo(java.lang.String title,
                            int obj)