Class Index | File Index

Classes


Class Program

Represents a shader program in the WebGL pipeline.
Defined in: benchgl.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Program(vertex, fragment)
Creates a new Program.
Method Summary
Method Attributes Method Name and Description
 
bind()
Binds this Program as the current shader program in the WebGL pipeline.
 
bindAttribute(name, options)
Binds an attribute buffer in this Program.
 
bindAttributes(mapping)
Binds all the attributes in this Program following a mapping.
 
bindSampler(name, value)
Binds a sampler variable to a unit in this Program.
 
bindSamplers(mapping)
Binds all the sampler variables in this Program following a mapping.
 
bindUniform(name, value)
Binds an uniform variable in this Program.
 
bindUniforms(mapping)
Binds all the uniform variables in this Program following a mapping.
 
Destroys this Program.
<static>  
Program.factory(options)
Static factory method to generate a shader Program in different ways.
<static>  
Program.FromDefaults(options)
Static method to create a shader Program from shader's default sources.
<static>  
Program.FromScripts(options)
Static method to create a shader Program from shader's scripts inside a webpage.
<static>  
Program.FromSources(options)
Static method to create a shader Program from shader's sources.
<static>  
Program.FromUrls(options)
Static method to create a shader Program from shader's URLs.
 
link()
Links this Program.
 
Sets the fragment shader for this Program.
 
setShaders(vertex, fragment)
Sets the shaders for this Program.
 
Sets the vertex shader for this Program.
 
Unbinds this Program as the current shader program in the WebGL pipeline.
Class Detail
Program(vertex, fragment)
Creates a new Program.
Parameters:
{Shader} vertex
The vertex shader.
{Shader} fragment
The fragment shader.
Method Detail
bind()
Binds this Program as the current shader program in the WebGL pipeline.

{Program} bindAttribute(name, options)
Binds an attribute buffer in this Program.
Parameters:
{String} name
The name of the attribute.
{Object} options Optional
The options for the attribute to bind.
{Number} options.attributeType Optional
The WebGL attribute type.
{Number} options.dataType Optional
The WebGL type of an element in the attribute buffer.
{Number} options.drawType Optional
The WebGL drawing mode.
{Number} options.size Optional
The size of the attribute elements in bytes.
{Number} options.stride Optional
The stride of the attribute buffer.
{Number} options.offset Optional
The offset of the attribute buffer.
{Object} options.data Optional
The attribute buffer data.
Returns:
{Program} Returns this Program.

{Program} bindAttributes(mapping)
Binds all the attributes in this Program following a mapping.
Parameters:
{Object} mapping
The mapping that specifies values for the attributes.
Returns:
{Program} Returns this Program.

{Program} bindSampler(name, value)
Binds a sampler variable to a unit in this Program.
Parameters:
{String} name
The name of the sampler.
{Number} value
The value for the unit to bind the sampler to.
Returns:
{Program} Returns this Program.

{Program} bindSamplers(mapping)
Binds all the sampler variables in this Program following a mapping.
Parameters:
{Object} mapping
The mapping that specifies units for the sampler.
Returns:
{Program} Returns this Program.

{Program} bindUniform(name, value)
Binds an uniform variable in this Program.
Parameters:
{String} name
The name of the uniform.
{Object} value
The value for the uniform to bind.
Returns:
{Program} Returns this Program.

{Program} bindUniforms(mapping)
Binds all the uniform variables in this Program following a mapping.
Parameters:
{Object} mapping
The mapping that specifies values for the uniforms.
Returns:
{Program} Returns this Program.

destroy()
Destroys this Program.

<static> {Program} Program.factory(options)
Static factory method to generate a shader Program in different ways.
Parameters:
{Object} options
The options for creating the Program.
Returns:
{Program} A new Program.

<static> {Program} Program.FromDefaults(options)
Static method to create a shader Program from shader's default sources.
Parameters:
{Object} options Optional
The options for creating the Program.
{String} options.vertex Optional, Default: 'Deafult'
The id string for the vertex shader.
{String} options.fragment Optional, Default: 'Default'
The id string for the fragment shader.
Returns:
{Program} A new Program.

<static> {Program} Program.FromScripts(options)
Static method to create a shader Program from shader's scripts inside a webpage.
Parameters:
{Object} options Optional
The options for creating the Program.
{String} options.vertex
The HTML element containing the vertex shader.
{String} options.fragment
The HTML elemente containing the fragment shader.
Returns:
{Program} A new Program.

<static> {Program} Program.FromSources(options)
Static method to create a shader Program from shader's sources.
Parameters:
{Object} options Optional
The options for creating the Program.
{String} options.vertex
The source string for the vertex shader.
{String} options.fragment
The source string for the fragment shader.
Returns:
{Program} A new Program.

<static> {Program} Program.FromUrls(options)
Static method to create a shader Program from shader's URLs.
Parameters:
{Object} options Optional
The options for creating the Program.
{String} options.vertex Optional
The URL string for the vertex shader.
{String} options.fragment Optional
The URL string for the fragment shader.
{Function} options.onSuccess Optional
A callback to call in case of success.
{Function} options.onError Optional
A callback to call in case of failure.
Returns:
{Program} A new Program.

link()
Links this Program.

{Program} setFragmentShader(shader)
Sets the fragment shader for this Program.
Parameters:
{Shader} shader
The fragment shader to set.
Returns:
{Program} Returns this Program.

{Program} setShaders(vertex, fragment)
Sets the shaders for this Program.
Parameters:
{Shader} vertex
The vertex shader to set.
{Shader} fragment
The fragment shader to set.
Returns:
{Program} Returns this Program.

{Program} setVertexShader(shader)
Sets the vertex shader for this Program.
Parameters:
{Shader} shader
The vertex shader to set.
Returns:
{Program} Returns this Program.

unbind()
Unbinds this Program as the current shader program in the WebGL pipeline.

Documentation generated by JsDoc Toolkit 2.4.0 on Thu May 19 2011 00:47:49 GMT+0200 (CEST)