codeanticode.glgraphics
Class GLSLShaderAttribute

java.lang.Object
  extended by codeanticode.glgraphics.GLSLShaderAttribute
All Implemented Interfaces:
GLConstants
Direct Known Subclasses:
GLModelEffectVertexAttrib

public class GLSLShaderAttribute
extends java.lang.Object

This class stores the attribute variable of a GLSL shader.


Field Summary
 
Fields inherited from interface codeanticode.glgraphics.GLConstants
BACKGROUND_ALPHA, CG_CONTEXT, CG_EFFECT, CG_PROGRAM, COLOR, DOUBLE, FLOAT, FRAGMENT_PROGRAM, GEOMETRY_PROGRAM, GL_DEPTH_STENCIL, GL_DEPTH24_STENCIL8, GL_FRAME_BUFFER, GL_PIXEL_BUFFER, GL_RENDER_BUFFER, GL_TEXTURE_OBJECT, GL_UNSIGNED_INT_24_8, GL_VERTEX_BUFFER, GLGRAPHICS, GLSL_PROGRAM, GLSL_SHADER, IDENTITY_MATRIX, INVERSE_MATRIX, INVERSE_TRANSPOSE_MATRIX, LINE_ADJACENCY, LINEAR_MIPMAP_LINEAR, LINEAR_MIPMAP_NEAREST, LINEAR_SAMPLING, NEAREST_MIPMAP_LINEAR, NEAREST_MIPMAP_NEAREST, NEAREST_SAMPLING, SHADER_VAR_ARRAY, 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, TRIANGLE_ADJACENCY, VERTEX_PROGRAM
 
Constructor Summary
GLSLShaderAttribute(processing.core.PApplet parent, GLShader shader, java.lang.String name, java.lang.String label, int type)
          Creates an instance of GLSLShaderUniform using the specified parameters.
GLSLShaderAttribute(processing.core.PApplet parent, java.lang.String name, java.lang.String label, int type)
          Creates an instance of GLSLShaderAttribute using the specified parameters.
 
Method Summary
 boolean available()
          Returns true or false depending on whether this variable is available for use.
 void copyToShader()
          Copies the parameter value to the GPU.
 void disableVertexAttribArray()
           
 void enableVertexAttribArray()
           
 int getArrayLength()
          Returns array length.
 java.lang.String getLabel()
          Returns parameter label.
 java.lang.String getName()
          Returns parameter name.
 int getType()
          Returns parameter type.
static int getType(java.lang.String typeStr)
          Returns the int constant that identifies a type, given the corresponding string.
 void init()
          Initializes this shader variable.
 void setAttribArrayPointer(int size, boolean normalized, int fist)
           
 void setShader(GLShader shader)
          Sets the shader this parameter corresponds to.
 void setValue(float value)
          Sets the parameter value when the type is float.
 void setValue(float[] value)
          Sets the parameter value for any type.
 void setValue(int value)
          Sets the parameter value when the type is int.
 void setValue(int i, float value)
          Sets the ith value for the parameter (only valid for vec or mat types).
 void setValue(int i, int j, float value)
          Sets the (ith, jth) value for the parameter (only valid for mat types).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GLSLShaderAttribute

public GLSLShaderAttribute(processing.core.PApplet parent,
                           java.lang.String name,
                           java.lang.String label,
                           int type)
Creates an instance of GLSLShaderAttribute using the specified parameters. The shader is set to null.

Parameters:
parent - PApplet
name - String
label - String
type - int

GLSLShaderAttribute

public GLSLShaderAttribute(processing.core.PApplet parent,
                           GLShader shader,
                           java.lang.String name,
                           java.lang.String label,
                           int type)
Creates an instance of GLSLShaderUniform using the specified parameters.

Parameters:
parent - PApplet
shader - GLShader
name - String
label - String
type - int
Method Detail

available

public boolean available()
Returns true or false depending on whether this variable is available for use.

Returns:
boolean

init

public void init()
Initializes this shader variable.


enableVertexAttribArray

public void enableVertexAttribArray()

disableVertexAttribArray

public void disableVertexAttribArray()

setAttribArrayPointer

public void setAttribArrayPointer(int size,
                                  boolean normalized,
                                  int fist)

copyToShader

public void copyToShader()
Copies the parameter value to the GPU.


setShader

public void setShader(GLShader shader)
Sets the shader this parameter corresponds to.

Parameters:
shader - GLShader

setValue

public void setValue(int value)
Sets the parameter value when the type is int.

Parameters:
value - int

setValue

public void setValue(float value)
Sets the parameter value when the type is float.

Parameters:
value - float

setValue

public void setValue(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[]

setValue

public void setValue(int i,
                     float value)
Sets the ith value for the parameter (only valid for vec or mat types).

Parameters:
int - i
value - float

setValue

public void setValue(int i,
                     int j,
                     float value)
Sets the (ith, jth) value for the parameter (only valid for mat types).

Parameters:
int - i
int - j
value - float

getType

public static int getType(java.lang.String typeStr)
Returns the int constant that identifies a type, given the corresponding string.

Parameters:
String - typeStr
Returns:
int

getType

public int getType()
Returns parameter type.

Returns:
int

getName

public java.lang.String getName()
Returns parameter name.

Returns:
String

getLabel

public java.lang.String getLabel()
Returns parameter label.

Returns:
String

getArrayLength

public int getArrayLength()
Returns array length.

Returns:
String


processing library GLGraphics by Andres Colubri. (c) 2008-2011