|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object codeanticode.glgraphics.GLShader codeanticode.glgraphics.GLCgShader
public class GLCgShader
This class encapsulates a Cg shader. Based in the code by Victor Martins (http://www.pixelnerve.com/v/)
Field Summary |
---|
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 | |
---|---|
void |
delete()
|
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. |
boolean |
isInitialized()
Returns true or false depending on whether the shader is initialized or not. |
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,
GLTexture tex)
Sets the texture parameter name with the OpenGL id of the provided texture object. |
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 |
---|
public GLCgShader(processing.core.PApplet parent)
parent
- PAppletpublic GLCgShader(processing.core.PApplet parent, java.lang.String vertexFN, java.lang.String fragmentFN)
parent
- PAppletvertexFN
- StringfragmentFN
- Stringpublic GLCgShader(processing.core.PApplet parent, java.lang.String vertexFN, java.lang.String geometryFN, java.lang.String fragmentFN)
parent
- PAppletvertexFN
- StringfragmentFN
- StringMethod 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
url
- URLpublic 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 boolean isInitialized()
isInitialized
in class GLShader
public void start()
start
in class GLShader
public void stop()
stop
in class GLShader
public CGparameter getVertexParameter(java.lang.String name)
name
- Stringpublic CGparameter getGeometryParameter(java.lang.String name)
name
- Stringpublic CGparameter getFragmentParameter(java.lang.String name)
name
- Stringpublic void setProgram(int p)
p
- intpublic void setTexParameter(java.lang.String name, GLTexture tex)
name
- Stringtex
- GLTexturepublic void setIntParameter(java.lang.String name, int x)
name
- Stringx
- intpublic void setFloatParameter(java.lang.String name, float x)
name
- Stringx
- floatpublic void setVecParameter(java.lang.String name, float x, float y)
name
- Stringx
- floaty
- floatpublic void setVecParameter(java.lang.String name, float x, float y, float z)
name
- Stringx
- floaty
- floatz
- floatpublic void setVecParameter(java.lang.String name, float x, float y, float z, float w)
name
- Stringx
- floaty
- floatz
- floatw
- floatpublic void setMatParameter(java.lang.String name, float m00, float m01, float m10, float m11)
name
- Stringm00
- float
...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)
name
- Stringm00
- float
...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)
name
- Stringm00
- float
...public void setModelviewMatrix(java.lang.String name)
name
- Stringpublic void setProjectionMatrix(java.lang.String name)
name
- Stringpublic void setModelviewProjectionMatrix(java.lang.String name)
name
- Stringpublic void setTextureMatrix(java.lang.String name)
name
- String
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |