Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## codeanticode.glgraphics
Class GLSLShader

    java.lang.Object
      codeanticode.glgraphics.GLShader
          codeanticode.glgraphics.GLSLShader

All Implemented Interfaces:
  GLConstants

    public class GLSLShader

extends GLShader

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

Field Summary

Fields inherited from interface codeanticode.glgraphics.GLConstants
`BACKGROUND_ALPHA, COLOR, DOUBLE, FLOAT, FRAGMENT_PROGRAM, GEOMETRY_PROGRAM, GL_DEPTH_STENCIL, GL_DEPTH24_STENCIL8, GL_UNSIGNED_INT_24_8, GLGRAPHICS, IDENTITY_MATRIX, INVERSE_MATRIX, INVERSE_TRANSPOSE_MATRIX, LINE_LOOP, LINE_STRIP, LINEAR, LINEAR_MIPMAP_LINEAR, LINEAR_MIPMAP_NEAREST, NEAREST, NEAREST_MIPMAP_LINEAR, NEAREST_MIPMAP_NEAREST, POINT_SPRITES, SHADER_VAR_FLOAT, SHADER_VAR_INT, SHADER_VAR_MAT2, SHADER_VAR_MAT3, SHADER_VAR_MAT4, SHADER_VAR_MODELVIEW_MAT, SHADER_VAR_MODELVIEW_PROJECTION_MAT, SHADER_VAR_PROJECTION_MAT, SHADER_VAR_TEXTURE_MAT, SHADER_VAR_TEXTURE_SAMPLER, SHADER_VAR_VEC2, SHADER_VAR_VEC3, SHADER_VAR_VEC4, TEX_BYTE, TEX_INT, TEX_NORM, TEX_ONEDIM, TEX_RECT, TRANSPOSE_MATRIX, VERTEX_PROGRAM`

Constructor Summary
`GLSLShader(processing.core.PApplet parent)` Creates an instance of GLSLShader.
`GLSLShader(processing.core.PApplet parent, java.lang.String vertexFN, java.lang.String fragmentFN)` Creates a read-to-use instance of GLSLShader with vertex and fragment shaders
`GLSLShader(processing.core.PApplet parent, java.lang.String vertexFN, java.lang.String geometryFN, java.lang.String fragmentFN)` Creates a instance of GLSLShader with vertex, geometry and fragment shaders.

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` | `loadFragmentShader(java.lang.String file)` Loads and compiles the fragment shader contained in file.
`void` | `loadFragmentShader(java.net.URL url)` Loads and compiles the fragment shader contained in the URL.
`void` | `loadGeometryShader(java.lang.String file)` Loads and compiles the geometry shader contained in file.
`void` | `loadGeometryShader(java.net.URL url)` Loads and compiles the geometry shader contained in the URL
`void` | `loadVertexShader(java.lang.String file)` Loads and compiles the vertex shader contained in file.
`void` | `loadVertexShader(java.net.URL url)` Loads and compiles the vertex shader contained in the URL.
`void` | `setFloatAttribute(java.lang.String name, float x)` Sets the float attribute with name to the given value
`void` | `setFloatUniform(java.lang.String name, float x)` Sets the float uniform with name to the given value
`void` | `setIntUniform(java.lang.String name, int x)` Sets the int uniform with name to the given value
`void` | `setMatUniform(java.lang.String name, float m00, float m01, float m10, float m11)` Sets the mat2 uniform with name to the given values
`void` | `setMatUniform(java.lang.String name, float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)` Sets the mat3 uniform with name to the given values
`void` | `setMatUniform(java.lang.String name, float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)` Sets the mat3 uniform with name to the given values
`void` | `setTexUniform(java.lang.String name, int val)` Sets the texture uniform with name to the given value
`void` | `setup()` Links the shader program and validates it.
`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` | `setVecAttribute(java.lang.String name, float x, float y)` Sets the vec2 attribute with name to the given values
`void` | `setVecAttribute(java.lang.String name, float x, float y, float z)` Sets the vec3 attribute with name to the given values
`void` | `setVecAttribute(java.lang.String name, float x, float y, float z, float w)` Sets the vec4 attribute with name to the given values
`void` | `setVecUniform(java.lang.String name, float x, float y)` Sets the vec2 uniform with name to the given values.
`void` | `setVecUniform(java.lang.String name, float x, float y, float z)` Sets the vec3 uniform with name to the given values.
`void` | `setVecUniform(java.lang.String name, float x, float y, float z, float w)` Sets the vec4 uniform with name to the given values.
`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

### GLSLShader

    public GLSLShader(processing.core.PApplet parent,
                      java.lang.String vertexFN,
                      java.lang.String fragmentFN)

  Creates a read-to-use instance of GLSLShader with vertex and fragment shaders

  Parameters:
    `parent` - PApplet
    `vertexFN` - String
    `fragmentFN` - String

### GLSLShader

    public GLSLShader(processing.core.PApplet parent,
                      java.lang.String vertexFN,
                      java.lang.String geometryFN,
                      java.lang.String fragmentFN)

  Creates a instance of GLSLShader with vertex, geometry and fragment shaders. The geometry shader needs to be configured with setupGeometryShader.

  Parameters:
    `parent` - PApplet
    `vertexFN` - String
    `geometryFN` - String
    `fragmentFN` - String
  See Also:
    `setupGeometryShader`

Method Detail

### loadVertexShader

    public void loadVertexShader(java.lang.String file)

  Loads and compiles the vertex shader contained in file.

  Specified by:
    `loadVertexShader` in class `GLShader`
  Parameters:
    `file` - String

### loadVertexShader

    public void loadVertexShader(java.net.URL url)

  Loads and compiles the vertex shader contained in the URL.

  Specified by:
    `loadVertexShader` in class `GLShader`
  Parameters:
    `file` - String

### loadGeometryShader

    public void loadGeometryShader(java.lang.String file)

  Loads and compiles the geometry shader contained in file.

  Specified by:
    `loadGeometryShader` in class `GLShader`
  Parameters:
    `file` - String

### loadGeometryShader

    public void loadGeometryShader(java.net.URL url)

  Loads and compiles the geometry shader contained in the URL

  Specified by:
    `loadGeometryShader` in class `GLShader`
  Parameters:
    `url` - URL

### loadFragmentShader

    public void loadFragmentShader(java.lang.String file)

  Loads and compiles the fragment shader contained in file.

  Specified by:
    `loadFragmentShader` in class `GLShader`
  Parameters:
    `file` - String

### loadFragmentShader

    public void loadFragmentShader(java.net.URL url)

  Loads and compiles the fragment shader contained in the URL.

  Specified by:
    `loadFragmentShader` in class `GLShader`
  Parameters:
    `url` - URL

### setup

    public void setup()

  Links the shader program and validates it.

  Specified by:
    `setup` in class `GLShader`

### start

    public void start()

  Starts the execution of the shader program.

  Specified by:
    `start` in class `GLShader`

### stop

    public void stop()

  Stops the execution of the shader program.

  Specified by:
    `stop` in class `GLShader`

### 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

### 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

### setTexUniform

    public void setTexUniform(java.lang.String name,
                              int val)

  Sets the texture uniform with name to the given value

  Parameters:
    `name` - String
    `val` - int

### setIntUniform

    public void setIntUniform(java.lang.String name,
                              int x)

  Sets the int uniform with name to the given value

  Parameters:
    `name` - String
    `x` - int

### setFloatUniform

    public void setFloatUniform(java.lang.String name,
                                float x)

  Sets the float uniform with name to the given value

  Parameters:
    `name` - String
    `x` - float

### setVecUniform

    public void setVecUniform(java.lang.String name,
                              float x,
                              float y)

  Sets the vec2 uniform with name to the given values.

  Parameters:
    `name` - String
    `x` - float
    `y` - float

### setVecUniform

    public void setVecUniform(java.lang.String name,
                              float x,
                              float y,
                              float z)

  Sets the vec3 uniform with name to the given values.

  Parameters:
    `name` - String
    `x` - float
    `y` - float
    `z` - float

### setVecUniform

    public void setVecUniform(java.lang.String name,
                              float x,
                              float y,
                              float z,
                              float w)

  Sets the vec4 uniform with name to the given values.

  Parameters:
    `name` - String
    `x` - float
    `y` - float
    `z` - float
    `w` - float

### setMatUniform

    public void setMatUniform(java.lang.String name,
                              float m00,
                              float m01,
                              float m10,
                              float m11)

  Sets the mat2 uniform with name to the given values

  Parameters:
    `name` - String
    `m00` - float ...

### setMatUniform

    public void setMatUniform(java.lang.String name,
                              float m00,
                              float m01,
                              float m02,
                              float m10,
                              float m11,
                              float m12,
                              float m20,
                              float m21,
                              float m22)

  Sets the mat3 uniform with name to the given values

  Parameters:
    `name` - String
    `m00` - float ...

### setMatUniform

    public void setMatUniform(java.lang.String name,
                              float m00,
                              float m01,
                              float m02,
                              float m03,
                              float m10,
                              float m11,
                              float m12,
                              float m13,
                              float m20,
                              float m21,
                              float m22,
                              float m23,
                              float m30,
                              float m31,
                              float m32,
                              float m33)

  Sets the mat3 uniform with name to the given values

  Parameters:
    `name` - String
    `m00` - float ...

### setFloatAttribute

    public void setFloatAttribute(java.lang.String name,
                                  float x)

  Sets the float attribute with name to the given value

  Parameters:
    `name` - String
    `x` - float

### setVecAttribute

    public void setVecAttribute(java.lang.String name,
                                float x,
                                float y)

  Sets the vec2 attribute with name to the given values

  Parameters:
    `name` - String
    `float` - x
    `float` - y

### setVecAttribute

    public void setVecAttribute(java.lang.String name,
                                float x,
                                float y,
                                float z)

  Sets the vec3 attribute with name to the given values

  Parameters:
    `name` - String
    `float` - x
    `float` - y
    `float` - z

### setVecAttribute

    public void setVecAttribute(java.lang.String name,
                                float x,
                                float y,
                                float z,
                                float w)

  Sets the vec4 attribute with name to the given values

  Parameters:
    `name` - String
    `float` - x
    `float` - y
    `float` - z
    `float` - w

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

processing library GLGraphics by Andres Colubri. (c) 2008