|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.opengl.renderer.ShaderObject
com.threerings.opengl.renderer.Program
public class Program
Contains a shader program.
| Nested Class Summary | |
|---|---|
static class |
Program.FloatUniform
A uniform containing a float. |
static class |
Program.IntegerUniform
A uniform containing an integer. |
static class |
Program.Matrix4fUniform
A uniform containing a 4x4 matrix. |
static class |
Program.Uniform
Contains the location and value of a uniform variable. |
static class |
Program.Vector2fUniform
A uniform containing a two-element vector. |
static class |
Program.Vector3fUniform
A uniform containing a three-element vector. |
static class |
Program.Vector4fUniform
A uniform containing a four-element vector. |
| Field Summary | |
|---|---|
protected HashMap<String,Integer> |
_attribLocations
Maps attribute names to their locations. |
protected Shader |
_fragment
The fragment shader. |
protected HashMap<String,Integer> |
_uniformLocations
Maps uniform names to their locations. |
protected HashIntMap<Program.Uniform> |
_uniforms
Maps uniform locations to their current values. |
protected static FloatBuffer |
_vbuf
Used to set values. |
protected Shader |
_vertex
The vertex shader. |
| Fields inherited from class com.threerings.opengl.renderer.ShaderObject |
|---|
_id, _renderer, ASCII_CHARSET |
| Constructor Summary | |
|---|---|
protected |
Program()
Creates an invalid program (used by the renderer to force reapplication). |
|
Program(Renderer renderer)
Creates a new shader program. |
| Method Summary | |
|---|---|
int |
getAttribLocation(String name)
Returns the location of the identified attribute. |
Shader |
getFragmentShader()
Returns a reference to the fragment shader. |
int |
getUniformLocation(String name)
Returns the location of the identified uniform variable. |
Shader |
getVertexShader()
Returns a reference to the vertex shader. |
boolean |
relink()
Relinks the program with its current vertex and fragment shaders. |
void |
setAttribLocation(String name,
int index)
Binds an attribute to the specified location. |
boolean |
setShaders(Shader vertex,
Shader fragment)
Sets the shaders for this program and links it. |
void |
setUniforms(Program.Uniform[] uniforms)
Sets the values of the shader's uniform variables. |
protected static ByteBuffer |
toBuffer(String string)
Creates a new byte buffer containing the specified string in null-terminated ASCII format. |
| Methods inherited from class com.threerings.opengl.renderer.ShaderObject |
|---|
delete, finalize, getId, getInfoLog |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Shader _vertex
protected Shader _fragment
protected HashMap<String,Integer> _uniformLocations
protected HashMap<String,Integer> _attribLocations
protected HashIntMap<Program.Uniform> _uniforms
protected static FloatBuffer _vbuf
| Constructor Detail |
|---|
public Program(Renderer renderer)
protected Program()
| Method Detail |
|---|
public boolean relink()
public boolean setShaders(Shader vertex,
Shader fragment)
ShaderObject.getInfoLog() can be used to return more information.
public Shader getVertexShader()
public Shader getFragmentShader()
public int getUniformLocation(String name)
public void setUniforms(Program.Uniform[] uniforms)
public void setAttribLocation(String name,
int index)
public int getAttribLocation(String name)
protected static ByteBuffer toBuffer(String string)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||