-
Name Type Description options
Options.
Name Type Description uniforms
Object.<string, module:ol/webgl/Helper~UniformValue> | undefined Uniform definitions; property names must match the uniform names in the provided or default shaders.
postProcesses
Array.<module:ol/webgl/Helper~PostProcessesOptions> | undefined Post-processes definitions
canvasCacheKey
string | undefined The cache key for the canvas.
Extends
- module:ol/Disposable~Disposable
Methods
-
Just bind the buffer if it's in the cache. Otherwise create the WebGL buffer, bind it, populate it, and add an entry to the cache.
Name Type Description buffer
module:ol/webgl/Buffer~WebGLArrayBuffer Buffer.
-
Will create or reuse a given webgl texture and apply the given size. If no image data specified, the texture will be empty, otherwise image data will be used and the
size
parameter will be ignored. Note: wrap parameters are set to clamp to edge, min filter is set to linear.Name Type Description size
Array.<number> Expected size of the texture
data
ImageData | HTMLImageElement | HTMLCanvasElement | undefined Image data/object to bind to the texture
texture
WebGLTexture | undefined Existing texture to reuse
Returns:
The generated texture
-
Execute a draw call based on the currently bound program, texture, buffers, attributes.
Name Type Description start
number Start index.
end
number End index.
-
Will enable the following attributes to be read from the currently bound buffer, i.e. tell the GPU where to read the different attributes in the buffer. An error in the size/type/order of attributes will most likely break the rendering and throw a WebGL exception.
Name Type Description attributes
Array.<module:ol/webgl/Helper~AttributeDescription> Ordered list of attributes to read from the buffer
-
Update the data contained in the buffer array; this is required for the new data to be rendered
Name Type Description buffer
module:ol/webgl/Buffer~WebGLArrayBuffer Buffer.
-
Will get the location from the shader or the cache
Name Type Description name
string Attribute name
Returns:
attribLocation
-
Returns:
Canvas.
-
Get the WebGL rendering context
Returns:
The rendering context.
-
Create a program for a vertex and fragment shader. Throws if shader compilation fails.
Name Type Description fragmentShaderSource
string Fragment shader source.
vertexShaderSource
string Vertex shader source.
Returns:
Program
-
Will get the location from the shader or the cache
Name Type Description name
string Uniform name
Returns:
uniformLocation
-
makeProjectionTransform(frameState, transform){module:ol/transform~Transform}
-
Modifies the given transform to apply the rotation/translation/scaling of the given frame state. The resulting transform can be used to convert world space coordinates to view coordinates.
Name Type Description frameState
module:ol/PluggableMap~FrameState Frame state.
transform
module:ol/transform~Transform Transform to update.
frameState.pixelRatio
number The pixel ratio of the frame.
frameState.time
number The time when rendering of the frame was requested.
frameState.viewState
module:ol/View~State The state of the current view.
frameState.animate
boolean Animate.
frameState.coordinateToPixelTransform
module:ol/transform~Transform CoordinateToPixelTransform.
frameState.declutterTree
module:rbush DeclutterTree.
frameState.extent
null | module:ol/extent~Extent Extent.
frameState.nextExtent
module:ol/extent~Extent | undefined Next extent during an animation series.
frameState.index
number Index.
frameState.layerStatesArray
Array.<module:ol/layer/Layer~State> LayerStatesArray.
frameState.layerIndex
number LayerIndex.
frameState.pixelToCoordinateTransform
module:ol/transform~Transform PixelToCoordinateTransform.
frameState.postRenderFunctions
Array.<module:ol/PluggableMap~PostRenderFunction> PostRenderFunctions.
frameState.size
module:ol/size~Size Size.
frameState.tileQueue
module:ol/TileQueue~TileQueue TileQueue.
frameState.usedTiles
Object.<string, Object.<string, boolean>> UsedTiles.
frameState.viewHints
Array.<number> ViewHints.
frameState.wantedTiles
Object.<string, Object.<string, boolean>> WantedTiles.
frameState.mapId
string The id of the map.
frameState.renderTargets
Object.<string, boolean> Identifiers of previously rendered elements.
Returns:
The updated transform object.
-
Clear the buffer & set the viewport to draw. Post process passes will be initialized here, the first one being bound as a render target for subsequent draw calls.
Name Type Description frameState
module:ol/PluggableMap~FrameState current frame state
disableAlphaBlend
boolean | undefined If true, no alpha blending will happen.
frameState.pixelRatio
number The pixel ratio of the frame.
frameState.time
number The time when rendering of the frame was requested.
frameState.viewState
module:ol/View~State The state of the current view.
frameState.animate
boolean Animate.
frameState.coordinateToPixelTransform
module:ol/transform~Transform CoordinateToPixelTransform.
frameState.declutterTree
module:rbush DeclutterTree.
frameState.extent
null | module:ol/extent~Extent Extent.
frameState.nextExtent
module:ol/extent~Extent | undefined Next extent during an animation series.
frameState.index
number Index.
frameState.layerStatesArray
Array.<module:ol/layer/Layer~State> LayerStatesArray.
frameState.layerIndex
number LayerIndex.
frameState.pixelToCoordinateTransform
module:ol/transform~Transform PixelToCoordinateTransform.
frameState.postRenderFunctions
Array.<module:ol/PluggableMap~PostRenderFunction> PostRenderFunctions.
frameState.size
module:ol/size~Size Size.
frameState.tileQueue
module:ol/TileQueue~TileQueue TileQueue.
frameState.usedTiles
Object.<string, Object.<string, boolean>> UsedTiles.
frameState.viewHints
Array.<number> ViewHints.
frameState.wantedTiles
Object.<string, Object.<string, boolean>> WantedTiles.
frameState.mapId
string The id of the map.
frameState.renderTargets
Object.<string, boolean> Identifiers of previously rendered elements.
-
Give a value for a standard float uniform
Name Type Description uniform
string Uniform name
value
number Value
-
Give a value for a standard matrix4 uniform
Name Type Description uniform
string Uniform name
value
Array.<number> Matrix value
-
Use a program. If the program is already in use, this will return
false
.Name Type Description program
WebGLProgram Program.
Returns:
Changed.