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 GLCgShader

    java.lang.Object
      codeanticode.glgraphics.GLShader
          codeanticode.glgraphics.GLCgShader

All Implemented Interfaces:
  GLConstants

    public class GLCgShader

extends GLShader

This class encapsulates a Cg shader. Based in the code by Victor Martins (http://www.pixelnerve.com/v/)

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
`GLCgShader(processing.core.PApplet parent)` Creates an instance of GLCgShader.
`GLCgShader(processing.core.PApplet parent, java.lang.String vertexFN, java.lang.String fragmentFN)` Creates a read-to-use instance of GLCgShader with vertex and fragment shaders
`GLCgShader(processing.core.PApplet parent, java.lang.String vertexFN, java.lang.String geometryFN, java.lang.String fragmentFN)` Creates a read-to-use instance of GLCgShader with vertex, geometry and fragment shaders

Method Summary
`CGparameter` | `getFragmentParameter(java.lang.String name)` Returns the parameter in the fragment shader with the sepcified name.
`CGparameter` | `getGeometryParameter(java.lang.String name)` Returns the parameter in the geometry shader with the sepcified name.
`CGparameter` | `getVertexParameter(java.lang.String name)` Returns the parameter in the vertex shader with the sepcified name.
`void` | `loadFragmentShader(java.lang.String file)` Reads fragment shader from file.
`void` | `loadFragmentShader(java.net.URL url)` Reads fragment shader from url.
`void` | `loadGeometryShader(java.lang.String file)` Reads geometry shader from file.
`void` | `loadGeometryShader(java.net.URL url)` Reads geometry shader from url.
`void` | `loadVertexShader(java.lang.String file)` Reads vertex shader from file.
`void` | `loadVertexShader(java.net.URL url)` Reads vertex shader from url.
`void` | `setFloatParameter(java.lang.String name, float x)` Sets the float parameter with name to the given value
`void` | `setIntParameter(java.lang.String name, int x)` Sets the int parameter with name to the given value
`void` | `setMatParameter(java.lang.String name, float m00, float m01, float m10, float m11)` Sets the mat2 parameter with name to the given values
`void` | `setMatParameter(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 parameter with name to the given value
`void` | `setMatParameter(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 mat4 parameter with name to the given value
`void` | `setModelviewMatrix(java.lang.String name)` Copies the modelview matrix from OpenGL to parameter name in the shader.
`void` | `setModelviewProjectionMatrix(java.lang.String name)` Copies the modelview-projection matrix from OpenGL to parameter name in the shader.
`void` | `setProgram(int p)` Sets the current program which we pass parameters to.
`void` | `setProjectionMatrix(java.lang.String name)` Copies the projection matrix from OpenGL to parameter name in the shader.
`void` | `setTexParameter(java.lang.String name, int val)` Sets the texture parameter with name to the given value
`void` | `setTextureMatrix(java.lang.String name)` Copies the texture matrix from OpenGL to parameter name in the shader.
`void` | `setup()` Compiles all the shaders.
`void` | `setVecParameter(java.lang.String name, float x, float y)` Sets the vec2 parameter with name to the given values
`void` | `setVecParameter(java.lang.String name, float x, float y, float z)` Sets the vec3 parameter with name to the given values
`void` | `setVecParameter(java.lang.String name, float x, float y, float z, float w)` Sets the vec4 parameter with name to the given values
`void` | `start()` Starts shader execution.
`void` | `stop()` Stops shader execution.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GLCgShader

    public GLCgShader(processing.core.PApplet parent)

  Creates an instance of GLCgShader.

  Parameters:
    `parent` - PApplet

### GLCgShader

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

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

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

### GLCgShader

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

  Creates a read-to-use instance of GLCgShader with vertex, geometry and fragment shaders

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

Method Detail

### loadVertexShader

    public void loadVertexShader(java.lang.String file)

  Reads vertex shader from file.

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

### loadVertexShader

    public void loadVertexShader(java.net.URL url)

  Reads vertex shader from url.

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

### loadGeometryShader

    public void loadGeometryShader(java.lang.String file)

  Reads geometry shader from file.

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

### loadGeometryShader

    public void loadGeometryShader(java.net.URL url)

  Reads geometry shader from url.

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

### loadFragmentShader

    public void loadFragmentShader(java.lang.String file)

  Reads fragment shader from file.

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

### loadFragmentShader

    public void loadFragmentShader(java.net.URL url)

  Reads fragment shader from url.

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

### setup

    public void setup()

  Compiles all the shaders.

  Specified by:
    `setup` in class `GLShader`

### start

    public void start()

  Starts shader execution.

  Specified by:
    `start` in class `GLShader`

### stop

    public void stop()

  Stops shader execution.

  Specified by:
    `stop` in class `GLShader`

### getVertexParameter

    public CGparameter getVertexParameter(java.lang.String name)

  Returns the parameter in the vertex shader with the sepcified name.

  Parameters:
    `name` - String

### getGeometryParameter

    public CGparameter getGeometryParameter(java.lang.String name)

  Returns the parameter in the geometry shader with the sepcified name.

  Parameters:
    `name` - String

### getFragmentParameter

    public CGparameter getFragmentParameter(java.lang.String name)

  Returns the parameter in the fragment shader with the sepcified name.

  Parameters:
    `name` - String

### setProgram

    public void setProgram(int p)

  Sets the current program which we pass parameters to. p could be VERTEX_PROGRAM, FRAGMENT_PROGRAM or GEOMETRY_PROGRAM

  Parameters:
    `p` - int

### setTexParameter

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

  Sets the texture parameter with name to the given value

  Parameters:
    `name` - String
    `tex` - GLTexture

### setIntParameter

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

  Sets the int parameter with name to the given value

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

### setFloatParameter

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

  Sets the float parameter with name to the given value

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

### setVecParameter

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

  Sets the vec2 parameter with name to the given values

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

### setVecParameter

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

  Sets the vec3 parameter with name to the given values

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

### setVecParameter

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

  Sets the vec4 parameter with name to the given values

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

### setMatParameter

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

  Sets the mat2 parameter with name to the given values

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

### setMatParameter

    public void setMatParameter(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 parameter with name to the given value

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

### setMatParameter

    public void setMatParameter(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 mat4 parameter with name to the given value

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

### setModelviewMatrix

    public void setModelviewMatrix(java.lang.String name)

  Copies the modelview matrix from OpenGL to parameter name in the shader.

  Parameters:
    `name` - String

### setProjectionMatrix

    public void setProjectionMatrix(java.lang.String name)

  Copies the projection matrix from OpenGL to parameter name in the shader.

  Parameters:
    `name` - String

### setModelviewProjectionMatrix

    public void setModelviewProjectionMatrix(java.lang.String name)

  Copies the modelview-projection matrix from OpenGL to parameter name in the shader.

  Parameters:
    `name` - String

### setTextureMatrix

    public void setTextureMatrix(java.lang.String name)

  Copies the texture matrix from OpenGL to parameter name in the shader.

  Parameters:
    `name` - String

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