-
Name Type Description optionsOptions.
Name Type Description uniformsObject.<string, module:ol/webgl/Helper~UniformValue> Uniform definitions; property names must match the uniform names in the provided or default shaders.
postProcessesArray.<module:ol/webgl/Helper~PostProcessesOptions> Post-processes definitions
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 buffermodule: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
sizeparameter will be ignored. Note: wrap parameters are set to clamp to edge, min filter is set to linear.Name Type Description sizeArray.<number> Expected size of the texture
dataImageData | HTMLImageElement | HTMLCanvasElement Image data/object to bind to the texture
textureWebGLTexture Existing texture to reuse
Returns:
The generated texture
-
Execute a draw call based on the currently bound program, texture, buffers, attributes.
Name Type Description startnumber Start index.
endnumber 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 attributesArray.<module:ol/webgl/Helper~AttributeDescription> Ordered list of attributes to read from the buffer
-
Apply the successive post process passes which will eventually render to the actual canvas.
Name Type Description frameStatecurrent frame state
Name Type Description pixelRationumber The pixel ratio of the frame.
timenumber The time when rendering of the frame was requested.
viewStatemodule:ol/View~State The state of the current view.
animateboolean coordinateToPixelTransformmodule:ol/transform~Transform declutterTreemodule:rbush extentnull | module:ol/extent~Extent indexnumber layerStatesArrayArray.<module:ol/layer/Layer~State> layerIndexnumber pixelToCoordinateTransformmodule:ol/transform~Transform postRenderFunctionsArray.<module:ol/PluggableMap~PostRenderFunction> sizemodule:ol/size~Size tileQueuemodule:ol/TileQueue~TileQueue usedTilesObject.<string, Object.<string, boolean>> viewHintsArray.<number> wantedTilesObject.<string, Object.<string, boolean>> -
Update the data contained in the buffer array; this is required for the new data to be rendered
Name Type Description buffermodule:ol/webgl/Buffer~WebGLArrayBuffer Buffer.
-
Will get the location from the shader or the cache
Name Type Description namestring 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 fragmentShaderSourcestring Fragment shader source.
vertexShaderSourcestring Vertex shader source.
Returns:
Program
-
Will get the location from the shader or the cache
Name Type Description namestring 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 frameStatemodule:ol/PluggableMap~FrameState Frame state.
transformmodule:ol/transform~Transform Transform to update.
frameState.pixelRationumber The pixel ratio of the frame.
frameState.timenumber The time when rendering of the frame was requested.
frameState.viewStatemodule:ol/View~State The state of the current view.
frameState.animateboolean frameState.coordinateToPixelTransformmodule:ol/transform~Transform frameState.declutterTreemodule:rbush frameState.extentnull | module:ol/extent~Extent frameState.indexnumber frameState.layerStatesArrayArray.<module:ol/layer/Layer~State> frameState.layerIndexnumber frameState.pixelToCoordinateTransformmodule:ol/transform~Transform frameState.postRenderFunctionsArray.<module:ol/PluggableMap~PostRenderFunction> frameState.sizemodule:ol/size~Size frameState.tileQueuemodule:ol/TileQueue~TileQueue frameState.usedTilesObject.<string, Object.<string, boolean>> frameState.viewHintsArray.<number> frameState.wantedTilesObject.<string, Object.<string, boolean>> 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 frameStatecurrent frame state
Name Type Description pixelRationumber The pixel ratio of the frame.
timenumber The time when rendering of the frame was requested.
viewStatemodule:ol/View~State The state of the current view.
animateboolean coordinateToPixelTransformmodule:ol/transform~Transform declutterTreemodule:rbush extentnull | module:ol/extent~Extent indexnumber layerStatesArrayArray.<module:ol/layer/Layer~State> layerIndexnumber pixelToCoordinateTransformmodule:ol/transform~Transform postRenderFunctionsArray.<module:ol/PluggableMap~PostRenderFunction> sizemodule:ol/size~Size tileQueuemodule:ol/TileQueue~TileQueue usedTilesObject.<string, Object.<string, boolean>> viewHintsArray.<number> wantedTilesObject.<string, Object.<string, boolean>> -
Give a value for a standard float uniform
Name Type Description uniformstring Uniform name
valuenumber Value
-
Give a value for a standard matrix4 uniform
Name Type Description uniformstring Uniform name
valueArray.<number> Matrix value
-
Use a program. If the program is already in use, this will return
false.Name Type Description programWebGLProgram Program.
Returns:
Changed.
OpenLayers