Implementation of a GL Program object.
This class parses the source code to obtain the names and types of
uniforms, attributes, varyings and constants. This information is used
to provide the user with a natural way to set variables.
Check the data shape given for uniforms and attributes
Convert uniform data to array of the correct type
Check whether any variables are set that are not present in source code
Check whether a set uniform/attribute is not active (a warning is given)
Check whether anactive attribute or uniform is not set (a warning is given)
Shader program object
A Program is an object to which shaders can be attached and linked to
create the final program.
Uniforms and attributes can be set using indexing: e.g.
program['a_pos'] = pos_data and program['u_color'] = (1, 0, 0).
program['a_pos'] = pos_data
program['u_color'] = (1, 0, 0)
The vertex shader to be used by this program
The fragment shader to be used by this program
The program will prepare a structured vertex buffer of count
vertices. All attributes set using prog['attr'] = X will
be combined into a structured vbo with interleaved elements, which
is more efficient than having one vbo per attribute.
prog['attr'] = X
If several shaders are specified, only one can contain the main
function. OpenGL ES 2.0 does not support a list of shaders.
Bind a VertexBuffer that has structured data
The vertex buffer to bind. The field names of the array
are mapped to attribute names in GLSL.
Draw the attribute arrays in the specified mode.
‘points’, ‘lines’, ‘line_strip’, ‘line_loop’, ‘lines_adjacency’,
‘line_strip_adjacency’, ‘triangles’, ‘triangle_strip’, or
Array of indices to draw.
Check error after draw.
Set the vertex and fragment shaders.
Source code for vertex shader.
Source code for fragment shaders.
Source code for geometry shader.
If True, then process any pending variables immediately after
setting shader code. Default is True.
All currently attached shaders
A list of the variables in use by the current program
The list is obtained by parsing the GLSL source code.
Each variable is represented as a tuple (kind, type, name),
where kind is ‘attribute’, ‘uniform’, ‘uniform_array’,
‘varying’ or ‘const’.