com.threerings.opengl.renderer
Class Program

java.lang.Object
  extended by com.threerings.opengl.renderer.ShaderObject
      extended by com.threerings.opengl.renderer.Program

public class Program
extends ShaderObject

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.
 
Constructor Summary
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.
 
Methods inherited from class com.threerings.opengl.renderer.ShaderObject
delete, getId, getInfoLog
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Program

public Program(Renderer renderer)
Creates a new shader program.

Method Detail

relink

public boolean relink()
Relinks the program with its current vertex and fragment shaders.

Returns:
true if the program linked successfully, false if there was an error.

setShaders

public boolean setShaders(Shader vertex,
                          Shader fragment)
Sets the shaders for this program and links it. If linkage fails (or even if it succeeds), ShaderObject.getInfoLog() can be used to return more information.

Returns:
true if the program linked successfully, false if there was an error.

getVertexShader

public Shader getVertexShader()
Returns a reference to the vertex shader.


getFragmentShader

public Shader getFragmentShader()
Returns a reference to the fragment shader.


getUniformLocation

public int getUniformLocation(String name)
Returns the location of the identified uniform variable.


setUniforms

public void setUniforms(Program.Uniform[] uniforms)
Sets the values of the shader's uniform variables.


setAttribLocation

public void setAttribLocation(String name,
                              int index)
Binds an attribute to the specified location.


getAttribLocation

public int getAttribLocation(String name)
Returns the location of the identified attribute.



Copyright © 2011. All Rights Reserved.