### codeanticode.glgraphics

# Class GLTextureFilter

- `java.lang.Object`
- - `codeanticode.glgraphics.GLTextureFilter`

Implemented Interfaces:
  PConstants

`public class GLTextureFilter`
`extends java.lang.Object`
`implements PConstants`

This class defines a 2D filter to apply on GLTexture objects. A filter is basically a glsl shader program with a set of predefined uniform attributes and a 2D grid where the input textures are mapped on. The points of the 2D grid can be altered in the vertex stage of the filter, allowing for arbitrary distorsions in the shape of the mesh. The filter is specified in a xml file where the files names of the vertex and fragment shaders stored, as well as the definition of the grid (resolution and spacing).

  ## Constructor Summary
  `GLTextureFilter()` Default constructor.
  `GLTextureFilter(PApplet parent, String filename)` Creates an instance of GLTextureFilter, loading the filter from filename.
  `GLTextureFilter(PApplet parent, URL url)` Creates an instance of GLTextureFilter, loading the filter from a URL.

  ## Method Summary
  `void` | `apply(GLTexture srcTex, GLTexture destTex)` Applies the shader program on texture srcTex, writing the output to the texture destTex.
  `void` | `apply(GLTexture srcTex, GLTexture destTex, GLModel destModel)` Applies the shader program on texture srcTex, writing the output to the texture destTex and model destModel.
  `void` | `apply(GLTexture srcTex, GLTexture destTex, float destA)` Applies the shader program on texture srcTex, writing the output to the texture destTex.
  `void` | `apply(GLTexture srcTex, GLTexture destTex, float destR, float destG, float destB, float destA)` Applies the shader program on texture srcTex, writing the output to the texture destTex.
  `void` | `apply(GLTexture[] srcTex, GLTexture destTex)` Applies the shader program on textures srcTex, writing the output to the texture destTex.
  `void` | `apply(GLTexture[] srcTex, GLTexture destTex, float destA)` Applies the shader program on textures srcTex, writing the output to the texture destTex.
  `void` | `apply(GLTexture[] srcTex, GLTexture destTex, float destR, float destG, float destB, float destA)` Applies the shader program on textures srcTex, writing the output to the texture destTex.
  `void` | `apply(GLTexture[] srcTex, GLTexture[] destTex)` Applies the shader program on textures srcTex, writing the output to the textures destTex.
  `void` | `apply(GLTexture[] srcTex, GLTexture[] destTex, GLModel destModel, float destR, float destG, float destB, float destA)` Applies the shader program on textures srcTex, writing the output to the textures destTex.
  `String` | `getDescription()` Returns the description of the filter.
  `int` | `getNumInputTextures()` Returns the maximum number of input or source textures supported by this filter.
  `int` | `getNumOutputTextures()` Returns the maximum number of output or destination textures supported by this filter.
  `GLTextureFilterParameter` | `getParameter(String paramName)` Returns the parameter with the provided name.
  `GLTextureFilterParameter` | `getParameter(int i)` Returns the i-th parameter.
  `int` | `getParameterCount()` Get number of parameters.
  `String` | `getParameterLabel(int i)` Returns the label of the i-th parameter.
  `String` | `getParameterName(int i)` Returns the name of the i-th parameter.
  `int` | `getParameterType(int i)` Returns the type of the i-th parameter.
  `void` | `noBlend()` Disables blending.
  `void` | `setBlendMode(int MODE)` Enables blending and sets the mode.
  `void` | `setParameterValue(String paramName, float value)` Sets the parameter value when the type is float.
  `void` | `setParameterValue(String paramName, float[] value)` Sets the parameter value for any type.
  `void` | `setParameterValue(String paramName, int value)` Sets the parameter value when the type is int.
  `void` | `setParameterValue(String paramName, int i, float value)` Sets the ith value for the parameter (only valid for vec or mat types).
  `void` | `setParameterValue(String paramName, int i, int j, float value)` Sets the (ith, jth) value for the parameter (only valid for mat types).
  `void` | `setParameterValue(int n, float value)` Sets the parameter value when the type is float.
  `void` | `setParameterValue(int n, float[] value)` Sets the parameter value for any type.
  `void` | `setParameterValue(int n, int value)` Sets the parameter value when the type is int.
  `void` | `setParameterValue(int n, int i, float value)` Sets the ith value for the parameter (only valid for vec or mat types).
  `void` | `setParameterValue(int n, int i, int j, float value)` Sets the (ith, jth) value for the parameter (only valid for mat types).
  `void` | `setParameterValues(float[] ...values)` Sets all the value for all the parameters, by means of a parameter list of variable length.

## Constructor Details

### GLTextureFilter

    public GLTextureFilter()

> Default constructor.

### GLTextureFilter

    public GLTextureFilter(PApplet parent,
                           String filename)

> Creates an instance of GLTextureFilter, loading the filter from filename.
> Parameters:
>   `parent` - PApplet
>   `filename` - String

### GLTextureFilter

    public GLTextureFilter(PApplet parent,
                           URL url)

> Creates an instance of GLTextureFilter, loading the filter from a URL.

## Method Details

### apply

    public void apply(GLTexture srcTex,
                      GLTexture destTex)

> Applies the shader program on texture srcTex, writing the output to the texture destTex. Sets fade constant to 1.
> Parameters:
>   `srcTex` - GLTexture
>   `destTex` - GLTexture

### apply

    public void apply(GLTexture srcTex,
                      GLTexture destTex,
                      GLModel destModel)

> Applies the shader program on texture srcTex, writing the output to the texture destTex and model destModel. Sets fade constant to 1.
> Parameters:
>   `srcTex` - GLTexture
>   `destTex` - GLTexture

### apply

    public void apply(GLTexture srcTex,
                      GLTexture destTex,
                      float destA)

> Applies the shader program on texture srcTex, writing the output to the texture destTex.
> Parameters:
>   `srcTex` - GLTexture
>   `destTex` - GLTexture
>   `destA` - float

### apply

    public void apply(GLTexture srcTex,
                      GLTexture destTex,
                      float destR,
                      float destG,
                      float destB,
                      float destA)

> Applies the shader program on texture srcTex, writing the output to the texture destTex.
> Parameters:
>   `srcTex` - GLTexture
>   `destTex` - GLTexture
>   `destR` - float
>   `destG` - float
>   `destB` - float
>   `destA` - float

### apply

    public void apply(GLTexture[] srcTex,
                      GLTexture destTex)

> Applies the shader program on textures srcTex, writing the output to the texture destTex. Sets fade constant to 1.
> Parameters:
>   `srcTex` - GLTexture[]
>   `destTex` - GLTexture

### apply

    public void apply(GLTexture[] srcTex,
                      GLTexture destTex,
                      float destA)

> Applies the shader program on textures srcTex, writing the output to the texture destTex.
> Parameters:
>   `srcTex` - GLTexture[]
>   `destTex` - GLTexture
>   `destA` - float

### apply

    public void apply(GLTexture[] srcTex,
                      GLTexture destTex,
                      float destR,
                      float destG,
                      float destB,
                      float destA)

> Applies the shader program on textures srcTex, writing the output to the texture destTex.
> Parameters:
>   `srcTex` - GLTexture[]
>   `destTex` - GLTexture
>   `destR` - float
>   `destG` - float
>   `destB` - float
>   `destA` - float

### apply

    public void apply(GLTexture[] srcTex,
                      GLTexture[] destTex)

> Applies the shader program on textures srcTex, writing the output to the textures destTex. Sets color constant to 1.
> Parameters:
>   `srcTex` - GLTexture[]
>   `destTex` - GLTexture[]

### apply

    public void apply(GLTexture[] srcTex,
                      GLTexture[] destTex,
                      GLModel destModel,
                      float destR,
                      float destG,
                      float destB,
                      float destA)

> Applies the shader program on textures srcTex, writing the output to the textures destTex. Color (r, g, b, a) can be used by the shader to colorize the output texture(s).
> Parameters:
>   `srcTex` - GLTexture[]
>   `destTex` - GLTexture[]
>   `destR` - float
>   `destG` - float
>   `destB` - float
>   `destA` - float

### getDescription

    public String getDescription()

> Returns the description of the filter.
> Returns:
>   String

### getNumInputTextures

    public int getNumInputTextures()

> Returns the maximum number of input or source textures supported by this filter. It can be called with less than that number
> Returns:
>   int

### getNumOutputTextures

    public int getNumOutputTextures()

> Returns the maximum number of output or destination textures supported by this filter.
> Returns:
>   int

### getParameter

    public GLTextureFilterParameter getParameter(String paramName)

> Returns the parameter with the provided name.
> Returns:
>   GLTextureFilterParameter

### getParameter

    public GLTextureFilterParameter getParameter(int i)

> Returns the i-th parameter.
> Returns:
>   GLTextureFilterParameter

### getParameterCount

    public int getParameterCount()

> Get number of parameters.
> Returns:
>   int

### getParameterLabel

    public String getParameterLabel(int i)

> Returns the label of the i-th parameter.
> Returns:
>   String

### getParameterName

    public String getParameterName(int i)

> Returns the name of the i-th parameter.
> Returns:
>   String

### getParameterType

    public int getParameterType(int i)

> Returns the type of the i-th parameter.
> Returns:
>   int

### noBlend

    public void noBlend()

> Disables blending.

### setBlendMode

    public void setBlendMode(int MODE)

> Enables blending and sets the mode.
> Parameters:
>   `MODE` - int

### setParameterValue

    public void setParameterValue(String paramName,
                                  float value)

> Sets the parameter value when the type is float.
> Parameters:

### setParameterValue

    public void setParameterValue(String paramName,
                                  float[] value)

> Sets the parameter value for any type. When the type is int or float, the first element of the value array is considered.
> Parameters:
>   `value` - float[]

### setParameterValue

    public void setParameterValue(String paramName,
                                  int value)

> Sets the parameter value when the type is int.
> Parameters:

### setParameterValue

    public void setParameterValue(String paramName,
                                  int i,
                                  float value)

> Sets the ith value for the parameter (only valid for vec or mat types).
> Parameters:
>   `value` - float

### setParameterValue

    public void setParameterValue(String paramName,
                                  int i,
                                  int j,
                                  float value)

> Sets the (ith, jth) value for the parameter (only valid for mat types).
> Parameters:
>   `value` - float

### setParameterValue

    public void setParameterValue(int n,
                                  float value)

> Sets the parameter value when the type is float.
> Parameters:

### setParameterValue

    public void setParameterValue(int n,
                                  float[] value)

> Sets the parameter value for any type. When the type is int or float, the first element of the value array is considered.
> Parameters:
>   `value` - float[]

### setParameterValue

    public void setParameterValue(int n,
                                  int value)

> Sets the parameter value when the type is int.
> Parameters:

### setParameterValue

    public void setParameterValue(int n,
                                  int i,
                                  float value)

> Sets the ith value for the parameter (only valid for vec or mat types).
> Parameters:
>   `value` - float

### setParameterValue

    public void setParameterValue(int n,
                                  int i,
                                  int j,
                                  float value)

> Sets the (ith, jth) value for the parameter (only valid for mat types).
> Parameters:
>   `value` - float

### setParameterValues

    public void setParameterValues(float[] ...values)

> Sets all the value for all the parameters, by means of a parameter list of variable length. values is an array of float[].
> Parameters:

processing library glgraphics by Andres Colubri. (c) 2008