-
Notifications
You must be signed in to change notification settings - Fork 1
Program
Alexander Orzechowski edited this page Oct 17, 2015
·
7 revisions
This links multiple Tessellator.Shader
to create a usable program.
- NOTE: This is a resource so it includes a
.dispose()
function. This program is added to the global list of resources located in the mainTessellator
context.
###Constructor
-
Tessellator.Program(<optional>Tessellator tessellator)
Constructs a newTessellator.Program
object. If the Tessellator object is not suplied then this program will inherit a Tessellator object from a linkedTessellator.Shader
.
###Functions
-
.link(Tessellator.Shader shader)
This will link aTessellator.Shader
and when the program is loaded with the.lead()
function it will use the linked shaders to create the program usable for rendering. - NOTE: if this program was created without a Tessellator passed to the constructor, then it will inherit it from the passed shader.
- SEE:
.load()
-
.load()
This function will take all the linked shader and combine them into a single program that can be used by renderers. - THROWS: if there are no shaders linked.
- NOTE: this will initialize the internal
.uniformManager
value with the default uniforms that the program contains. - NOTE: this will populate the
.attribs
object with values. - SEE:
.link()
-
.getLinked(Tessellator.Constant type)
The supplied type value must be aTessellator.VERTEX_SHADER
or aTessellator.FRAGMENT_SHADER
. This will iterate the linked shaders and return the one that has i's.type
property equal to the passed argument. - RETURN:
Tessellator.Shader
if there is a linked shader with the type of the passed argument - RETURN: null
.isReady()
- RETURN: the ready state of this program
.getAttributes()
- RETURN: a object populated the pointers of the attributes referenced in the vertex shader.
- NOTE: if this program is not loadeded, this will return an empty object.
-
.dispose()
this will release all resources associated with this program. When done using this program, call this function or else the program will never be removed from graphics memory. If you call.link()
then the program will be recreated as if the object was not disposed. Any linked shaders will get their.dispose()
called if their.disposable
flag is set to true - NOTE: The ready state of the program is cleared.
- SEE:
..link()
-
.disposable
This variable dictates whether this program can be disposed by inheritance. It does not matter what this variable is set to if you call this function yourself. - SEE:
.disposed
- DEFAULT: true
-
.disposed
This is a flag set to true if this resource is disposed. Calling.dispose()
this flag will be set to true. - DEFAULT: false
- SEE:
.dispose()
.getUniforms()
- RETURN: the
Tessellator.UniformManager
associated with this program.
###Internal
-
.setReady()
This will set the ready state of this program to true and call the.listener
function if there is one prevalent. - NOTE: This will clear the
.disposed
flag
-
.attribs
A object containing all the attributes referenced by the vertex shader. - SEE:
.getAttributes()
- DEFAULT: null
- NOTE: this property will be set to a empty object once the first shader is linked.
-
.bind()
This will set the current program being used by the WebGL context to this object. - NOTE: when binding it will check against a
.shader
attribute located in the mainTessellator
object to see if it is not rebinding itself.
-
.set()
This is called before rendering any geometry. Any sort of configuration or setting must be set inside this function. This will return true if this program is ready to be rendered with. - SEE:
Tessellator.Object
-
.uniformManager
This is a object that manages all the uniforms used by this program - SEE:
Tessellator.UniformManager
- DEFAULT: null
- NOTE: this property will be set once the first shader is linked.
-
.listener[Tessellator.Program program]
A variable set by other classes to listen for when this program is ready to be used. This is simply a callback function with the argument beingthis
passed back. - DEFAULT: null
-
source
Tessellator-
renderers
RendererAbstract
ModelRenderer
BufferedRenderer FullScreenRenderer -
shaders
Shader
Program
RenderMatrix -
geometry
Object
-