For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.
Class Context
Index
Constructors
Properties
activeTexture
bindElementBuffer
bindFramebuffer
bindRenderbuffer
bindTexture
bindVertexArray
bindVertexBuffer
blend
blendColor
blendEquation
blendFunc
boundUniformBuffers
clearColor
clearDepth
clearStencil
colorMask
cullFace
cullFaceSide
currentNumAttributes
depthFunc
depthMask
depthRange
depthTest
extTextureFilterAnisotropic
extTextureFilterAnisotropicMax?
frameUniformBuffer
freeProjectionUniformBuffers
frontFace
gl
keyedProjectionUniformBuffers
maxTextureSize
pixelStoreUnpack
pixelStoreUnpackFlipY
pixelStoreUnpackPremultiplyAlpha
program
projectionUniformBuffer
stencilFunc
stencilMask
stencilOp
stencilTest
terrainUniformBuffer
viewport
Methods
Constructors
constructor
Parameters
Returns Context
Properties
activeTexture
bindElementBuffer
bindFramebuffer
bindRenderbuffer
bindTexture
bindVertexArray
bindVertexBuffer
blend
blendColor
blendEquation
blendFunc
boundUniformBuffers
clearColor
clearDepth
clearStencil
colorMask
cullFace
cullFaceSide
currentNumAttributes
currentNumAttributes: number
depthFunc
depthMask
depthRange
depthTest
extTextureFilterAnisotropic
OptionalextTextureFilterAnisotropicMax
extTextureFilterAnisotropicMax?: number
frameUniformBuffer
freeProjectionUniformBuffers
frontFace
gl
keyedProjectionUniformBuffers
maxTextureSize
maxTextureSize: number
pixelStoreUnpack
pixelStoreUnpackFlipY
pixelStoreUnpackPremultiplyAlpha
program
projectionUniformBuffer
stencilFunc
stencilMask
stencilOp
stencilTest
terrainUniformBuffer
viewport
Methods
clear
Parameters
- __namedParameters: ClearArgs
Returns void
createFramebuffer
- createFramebuffer(
width: number,
height: number,
hasDepth: boolean,
hasStencil: boolean,
): FramebufferParameters
- width: number
- height: number
- hasDepth: boolean
- hasStencil: boolean
Returns Framebuffer
createIndexBuffer
- createIndexBuffer(
array: TriangleIndexArray | LineIndexArray | LineStripIndexArray,
dynamicDraw?: boolean,
): IndexBufferParameters
- array: TriangleIndexArray | LineIndexArray | LineStripIndexArray
OptionaldynamicDraw: boolean
Returns IndexBuffer
createRenderbuffer
Parameters
- storageFormat: number
- width: number
- height: number
Returns WebGLRenderbuffer
createVertexArray
Returns WebGLVertexArrayObject | undefined
createVertexBuffer
- createVertexBuffer(
array: StructArray,
attributes: readonly StructArrayMember[],
dynamicDraw?: boolean,
): VertexBufferParameters
- array: StructArray
- attributes: readonly StructArrayMember[]
OptionaldynamicDraw: boolean
Returns VertexBuffer
deleteVertexArray
Parameters
- x: WebGLVertexArrayObject | undefined
Returns void
setColorMode
setCullFace
Parameters
- cullFaceMode: Readonly<CullFaceMode>
Returns void
setCustomLayerDefaults
Reset some GL state to default values before handing users the raw context, as we do for custom layers and WebGL style images, to avoid hard-to-debug bugs in their code.
MapLibre restores all of its own state afterwards, so the only state worth resetting first is state users would be surprised to find dirty:
CULL_FACE,TEXTURE0and the threeUNPACK_settings, whose defaults are meaningful enough that most code assumes them. The vertex array is unbound rather than reset, so that MapLibre never has to track it and a user'svertexAttribPointercalls cannot land on one of ours.Returns void
setDefault
Returns void
setDepthMode
setDirty
Returns void
setStencilMode
Parameters
- stencilMode: Readonly<StencilMode>
Returns void
unbindVAO
Returns void
Internal
A webgl wrapper class to allow injection, mocking and abstraction