Class: ShaderProgram

og.shaderProgram.ShaderProgram

new og.shaderProgram.ShaderProgram(name, material)

Represents more comfortable using WebGL shader program.
Name Type Description
name string Shader program name identificator.
material object Object stores uniforms, attributes and program codes:
Name Type Description
uniforms object Uniforms definition section.
attributes object Attributes definition section.
vertexShader string Vertex glsl code.
fragmentShader string Fragment glsl code.

Members

_textureIDnumber

Texture counter.

attributesObject

Attributes.

fragmentShaderstring

Fragment shader.

glObject

Webgl context.

namestring

Shader progarm name.

uniformsObject

Uniforms.

vertexShaderstring

Vertex shader.

Methods

Apply current variables.
Creates program.
Name Type Description
gl Object WebGl context.
Delete program.
Disable current program vertexAttribArrays.

drawArray(mode, numItems)

Calls drawArrays function.
Name Type Description
mode number Draw mode(GL_TRIANGLES, GL_LINESTRING etc.).
numItems number Curent binded buffer drawing items count.

drawIndexBuffer(mode, buffer)

Calls drawElements index buffer function.
Name Type Description
mode number Draw mode(GL_TRIANGLES, GL_LINESTRING etc.).
buffer Object Index buffer.
Enable current program vertexAttribArrays.
Sets program variables.
Name Type Description
material Object Variables and values object.
Sets the current program frame.