Class vxlProgramManager

Constructor

vxlProgramManager(gl)

Presents a simple interface to communicate with a ESSL (GLSL) programThis class is responsible for creating, compiling and linking any ESSL program.It also has methods to query and set uniforms and attributes belonging to the programthat is being currently executed in the GPU

a vxlProgramManager maintains a database of the programs that have been linked to the GPU. This way, program switching is easier as it is not necessary to go through the compilation and linking process every time

The program manager simplifies working with ESSL programs. It providesget/set operations for attributes and uniforms and handles internally the location variablesof these elements which are required to operate with them in the GPU. In other wordsit hides gl.getAttribLocation and gl.getUniformLocation calls.

The program manager catches uniforms and only updates the GPU if needed.

The program manager is available through the pm attribute of vxlEngine

Parameters:

gl

Methods

.clearCache()
.disableAttribute(name)
Disables a vertex attribute array

Parameters:

Type Name Description
String name

the name of the attribute array to disable

.enableAttribute(name)
Enables a vertex attribute array

Parameters:

Type Name Description
String name

the name of the attribute array to enable

.getDefault(programID, uniformName)
Overrides defaults by hand

Parameters:

Type Name Description
programID

uniformName

.getUniform(the)
Returns a uniform value from the cache maintained by vxlProgramManager

Parameters:

Type Name Description
String the

uniform id

.loadDefaults()
Loads the uniform defaults for the current program
.releaseProgram()
.setAttributePointer(name, numElements, type, norm, stride, offset)
This method tells the WebGL context how to access the information contained in theWebGL buffer associated with the attribute

Parameters:

Type Name Description
String name

name of the attribute

numElements

type

norm

stride

offset

.setDefault(programID, uniformName, value)
Overrides defaults by hand

Parameters:

Type Name Description
programID

uniformName

value

.setProgram(p_program, p_force_it)
Tries to add a new program definition to this renderer

Parameters:

Type Name Description
vxlProgram p_program

an instance of a vxlProgram object or one of its descendants

p_force_it

.setUniform(p_uniform_id, p_value, hint)
Sets a uniform. Caches the uniform location.Uses polymorphism to make the programmers life happier

Parameters:

Type Name Description
String p_uniform_id

name

Object p_value

the uniform value

hint

.setUniforms(p_dictionary)
Sets all the uniforms defined by the object obj

Parameters:

Type Name Description
Object p_dictionary

an object containing uniform names and values. Every property of this objectwill be considered a uniform

.useProgram(ID)
Uses a program from the database.If you are not sure if the program you want to use is in the database then call vxlRenderer.setProgram instead

Parameters:

Type Name Description
String ID

the program id

See:

vxlRenderer#setProgram