Class: Shader

PhotoEditorSDK.Engine~ Shader

Represents a WebGL shader with a vertex shader, a fragment shader, uniforms and attributes

new Shader(renderer, vertexSource, fragmentSource, uniforms, attributes)

sdk/core/engine/shaders/shader.js, line 34

Creates a Shader

Name Type Description
renderer PhotoEditorSDK.Engine.BaseRenderer
vertexSource String
fragmentSource String
uniforms Object
attributes Array.<String>

Methods

_addPrecisionToSource(source){String}

sdk/core/engine/shaders/shader.js, line 177

Adds the preferred precision for the current device to the given shader source

Name Type Description
source String
Returns:
Type Description
String

dispose()

sdk/core/engine/shaders/shader.js, line 305

Cleans up this shader

getAttributeLocations(){Object}

sdk/core/engine/shaders/shader.js, line 294

Returns the attribute locations

Returns:
Type Description
Object

getAttributes(){Array.<String>}

sdk/core/engine/shaders/shader.js, line 288

Returns the attributes

Returns:
Type Description
Array.<String>

getProgram(){WebGLProgram}

sdk/core/engine/shaders/shader.js, line 300

Returns this shader's WebGL program

Returns:
Type Description
WebGLProgram

getUniforms(){Object}

sdk/core/engine/shaders/shader.js, line 280

Returns the uniforms

Returns:
Type Description
Object

setUniform(name, value, sync)

sdk/core/engine/shaders/shader.js, line 255

Sets the given uniform to the given value

Name Type Default Description
name String
value *
sync Boolean false

= false

setUniforms(uniforms, sync)

sdk/core/engine/shaders/shader.js, line 267

Sets the given uniforms to their values

Name Type Default Description
uniforms Object
sync Boolean false

= false

setupBuffers(vertexBuffer, indexBuffer)

sdk/core/engine/shaders/shader.js, line 76

Binds the given buffers for this shader

Name Type Description
vertexBuffer WebGLBuffer
indexBuffer WebGLBuffer

syncUniform(name)

sdk/core/engine/shaders/shader.js, line 100

Synchronizes the uniform with the given name

Name Type Description
name String

syncUniforms()

sdk/core/engine/shaders/shader.js, line 89

Synchronizes all uniforms with WebGL