The shader is the GLSL program used to render a Shape's vertices into colored pixels. Basic shaders define the skin material for a shape's mesh, using light sources, textures, and other information to color every pixel of the mesh's surfaces. More complex shaders can re-define the geometry of a shape as well as establishing the "skin".

	attributes: +List('positions', 'colors')
	uniforms: +List('mvpmatrix')

	vertex: "
		// Vertex shader for a self-lit mesh where each vertex has its own color\n
		#version 130\n
		uniform mat4 mvpmatrix;
		in  vec3 position;
		in  vec4 color;
		out vec4 vert_color;
		void main(void) {
			gl_Position = mvpmatrix * vec4(position, 1.0);
			vert_color = color;

	fragment: "
		// Fragment shader passes along interpolated, full opacity vec3 color from vertex shader\n
		#version 130\n
		in  vec4 vert_color;
		void main(void) {
			gl_FragColor = vert_color;

A shader is compiled the first time it is used. The compiled shader resides in the GPU until no longer referenced by anything. This can be encouraged by assigning ._program to null.

Class Properties

Create a new shader.

Instance Properties

A list of symbols for vertex attributes which should match the vertex properties found in every Shape which uses the shader. The order they are listed must match the order they are defined in the GLSL shaders. Their names need not match the shader's names. Some common vertex attributes used by shaders:
The positions of the vertices in Xyz coordinates.
The vertice's normals (in Xyz coords).
The vertice's tangents (in Xyz coords).
The vertice's binormal (in Xyz coords).
The vertice's texture mapping coordinates.
The vertice's colors (self-lit or diffuse when lit)
The GLSL source Text for the fragment shader
A List of symbols required by the shader as uniform variables The shader's listed uniform properties should match properties found in a shape or rendering context for a shape using this shader. The names listed must match the names of uniforms defined in the GLSL shaders. Some common uniform properties:

The origin of the rendering camera
The model-view matrix
The model-view-perspective matrix
The diffuse color for vertices.
The specular (shiny) colors for vertices.
The GLSL source Text for the vertex shader