|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object codeanticode.glgraphics.GLShader codeanticode.glgraphics.GLSLShader
public class GLSLShader
This class encapsulates a glsl shader. Based in the code by JohnG (http://www.hardcorepawn.com/)
Field Summary |
---|
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 | |
---|---|
void |
delete()
|
int |
getAttribLocation(java.lang.String name)
Returns the ID location of the attribute parameter given its name. |
int |
getMaxOutVertCount()
Returns the maximum number of vertices that can be emitted by the geometry shader. |
int |
getUniformLocation(java.lang.String name)
Returns the ID location of the uniform parameter given its name. |
boolean |
isInitialized()
Returns true or false depending on whether the shader is initialized or not. |
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,
GLTexture tex)
Sets the texture uniform with the unit of tex is attached to at the moment of running the shader. |
void |
setTexUniform(java.lang.String name,
int unit)
Sets the texture uniform name with the texture unit to use in the said uniform. |
void |
setup()
Links the shader program and validates it. |
void |
setupGeometryShader(int inGeoPrim,
int outGeoPrim)
Configures the geometry shader by setting the primitive types that it will take as input and return as output. |
void |
setupGeometryShader(int inGeoPrim,
int outGeoPrim,
int maxOutVert)
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 |
setupGeometryShader(java.lang.String inGeoPrim,
java.lang.String outGeoPrim)
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 |
setupGeometryShader(java.lang.String inGeoPrim,
java.lang.String outGeoPrim,
int maxOutVert)
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 |
---|
public GLSLShader(processing.core.PApplet parent)
parent
- PAppletpublic GLSLShader(processing.core.PApplet parent, java.lang.String vertexFN, java.lang.String fragmentFN)
parent
- PAppletvertexFN
- StringfragmentFN
- Stringpublic GLSLShader(processing.core.PApplet parent, java.lang.String vertexFN, java.lang.String geometryFN, java.lang.String fragmentFN)
parent
- PAppletvertexFN
- StringgeometryFN
- StringfragmentFN
- StringsetupGeometryShader
Method Detail |
---|
public void delete()
delete
in class GLShader
public void loadVertexShader(java.lang.String file)
loadVertexShader
in class GLShader
file
- Stringpublic void loadVertexShader(java.net.URL url)
loadVertexShader
in class GLShader
file
- Stringpublic void loadGeometryShader(java.lang.String file)
loadGeometryShader
in class GLShader
file
- Stringpublic void loadGeometryShader(java.net.URL url)
loadGeometryShader
in class GLShader
url
- URLpublic void loadFragmentShader(java.lang.String file)
loadFragmentShader
in class GLShader
file
- Stringpublic void loadFragmentShader(java.net.URL url)
loadFragmentShader
in class GLShader
url
- URLpublic void setup()
setup
in class GLShader
public int getMaxOutVertCount()
public boolean isInitialized()
isInitialized
in class GLShader
public void start()
start
in class GLShader
public void stop()
stop
in class GLShader
public void setupGeometryShader(int inGeoPrim, int outGeoPrim)
inGeoPrim
- intoutGeoPrim
- intpublic void setupGeometryShader(int inGeoPrim, int outGeoPrim, int maxOutVert)
inGeoPrim
- intoutGeoPrim
- intmaxNumOutVert
- intpublic void setupGeometryShader(java.lang.String inGeoPrim, java.lang.String outGeoPrim)
inGeoPrim
- StringoutGeoPrim
- Stringpublic void setupGeometryShader(java.lang.String inGeoPrim, java.lang.String outGeoPrim, int maxOutVert)
inGeoPrim
- StringoutGeoPrim
- StringmaxNumOutVert
- intpublic int getAttribLocation(java.lang.String name)
name
- String
public int getUniformLocation(java.lang.String name)
name
- String
public void setTexUniform(java.lang.String name, int unit)
name
- Stringunit
- intpublic void setTexUniform(java.lang.String name, GLTexture tex)
name
- Stringtex
- GLTexturepublic void setIntUniform(java.lang.String name, int x)
name
- Stringx
- intpublic void setFloatUniform(java.lang.String name, float x)
name
- Stringx
- floatpublic void setVecUniform(java.lang.String name, float x, float y)
nam
- Stringx
- floaty
- floatpublic void setVecUniform(java.lang.String name, float x, float y, float z)
name
- Stringx
- floaty
- floatz
- floatpublic void setVecUniform(java.lang.String name, float x, float y, float z, float w)
name
- Stringx
- floaty
- floatz
- floatw
- floatpublic void setMatUniform(java.lang.String name, float m00, float m01, float m10, float m11)
name
- Stringm00
- float
...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)
name
- Stringm00
- float
...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)
name
- Stringm00
- float
...public void setFloatAttribute(java.lang.String name, float x)
name
- Stringx
- floatpublic void setVecAttribute(java.lang.String name, float x, float y)
name
- Stringfloat
- xfloat
- ypublic void setVecAttribute(java.lang.String name, float x, float y, float z)
name
- Stringfloat
- xfloat
- yfloat
- zpublic void setVecAttribute(java.lang.String name, float x, float y, float z, float w)
name
- Stringfloat
- xfloat
- yfloat
- zfloat
- w
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |