Module: ol/webgl/Helper

ol/webgl/Helper


Classes

WebGLHelper

Members

module:ol/webgl/Helper.AttributeType{number}

Attribute types, either UNSIGNED_BYTE, UNSIGNED_SHORT, UNSIGNED_INT or FLOAT Note: an attribute stored in a Float32Array should be of type FLOAT.

module:ol/webgl/Helper.DefaultUniform{string}

Uniform names used in the default shaders: PROJECTION_MATRIX, OFFSET_SCALE_MATRIX. and OFFSET_ROTATION_MATRIX.

module:ol/webgl/Helper.ShaderType{number}

Shader types, either FRAGMENT_SHADER or VERTEX_SHADER.

Methods

module:ol/webgl/Helper.computeAttributesStride(attributes){number}

webgl/Helper.js, line 840
import {computeAttributesStride} from 'ol/webgl/Helper';

Compute a stride in bytes based on a list of attributes

Name Type Description
attributes Array.<module:ol/webgl/Helper~AttributeDescription>

Ordered list of attributes

Returns:
Stride, ie amount of values for each vertex in the vertex buffer

Type Definitions

AttributeDescription{Object}

Description of an attribute in a buffer

Properties:
Name Type Argument Description
name string

Attribute name to use in shaders

size number

Number of components per attributes

type module:ol/webgl/Helper~AttributeType <optional>

Attribute type, i.e. number of bytes used to store the value. This is determined by the class of typed array which the buffer uses (eg. Float32Array for a FLOAT attribute). Default is FLOAT.

BufferCacheEntry{Object}

Properties:
Name Type Description
buffer module:ol/webgl/Buffer~WebGLArrayBuffer
webGlBuffer WebGLBuffer

Options{Object}

Properties:
Name Type Argument Description
uniforms Object.<string, module:ol/webgl/Helper~UniformValue> <optional>

Uniform definitions; property names must match the uniform names in the provided or default shaders.

postProcesses Array.<module:ol/webgl/Helper~PostProcessesOptions> <optional>

Post-processes definitions

PostProcessesOptions{Object}

Properties:
Name Type Argument Description
scaleRatio number <optional>

Scale ratio; if < 1, the post process will render to a texture smaller than the main canvas which will then be sampled up (useful for saving resource on blur steps).

vertexShader string <optional>

Vertex shader source

fragmentShader string <optional>

Fragment shader source

uniforms Object.<string, module:ol/webgl/Helper~UniformValue> <optional>

Uniform definitions for the post process step

UniformLiteralValue{number} {Array.<number>} {HTMLCanvasElement} {HTMLImageElement} {ImageData} {module:ol/transform~Transform}

UniformValue()

webgl/Helper.js, line 77

Uniform value can be a number, array of numbers (2 to 4), canvas element or a callback returning one of the previous types.