Class: ShaderProgram

og/webgl/ShaderProgram~ShaderProgram

Represents more comfortable using WebGL shader program.

new ShaderProgram(name, material)

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

_attributesObject

Attributes.

_textureIDnumber

Texture counter.

_uniformsObject

Uniforms.

fragmentShaderstring

Fragment shader.

glObject

Webgl context.

namestring

Shader progarm name.

vertexShaderstring

Vertex shader.

Methods

staticmodule:og/webgl/ShaderProgram~ShaderProgram.bindBuffer(program, variable)

Bind program buffer.
Name Type Description
program og.webgl.ShaderProgram Used program.
variable Object Variable represents buffer data.
Apply current variables.

createProgram(gl)

Creates program.
Name Type Description
gl Object WebGl context.
Delete program.

disableAttribArrays()

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.

enableAttribArrays()

Enable current program vertexAttribArrays.
Sets program variables.
Name Type Description
material Object Variables and values object.
Sets the current program frame.