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

A webgl wrapper class to allow injection, mocking and abstraction

Index

Constructors

Properties

activeTexture: ActiveTextureUnit
bindElementBuffer: BindElementBuffer
bindFramebuffer: BindFramebuffer
bindRenderbuffer: BindRenderbuffer
bindTexture: BindTexture
bindVertexArray: BindVertexArray
bindVertexBuffer: BindVertexBuffer
blend: Blend
blendColor: BlendColor
blendEquation: BlendEquation
blendFunc: BlendFunc
boundUniformBuffers: WebGLBuffer[]
clearColor: ClearColor
clearDepth: ClearDepth
clearStencil: ClearStencil
colorMask: ColorMask
cullFace: CullFace
cullFaceSide: CullFaceSide
currentNumAttributes: number
depthFunc: DepthFunc
depthMask: DepthMask
depthRange: DepthRange
depthTest: DepthTest
extTextureFilterAnisotropic: EXT_texture_filter_anisotropic | null
extTextureFilterAnisotropicMax?: number
frameUniformBuffer: UniformBuffer
freeProjectionUniformBuffers: UniformBuffer[]
frontFace: FrontFace
keyedProjectionUniformBuffers: Map<string, UniformBuffer>
maxTextureSize: number
pixelStoreUnpack: PixelStoreUnpack
pixelStoreUnpackFlipY: PixelStoreUnpackFlipY
pixelStoreUnpackPremultiplyAlpha: PixelStoreUnpackPremultiplyAlpha
program: ProgramValue
projectionUniformBuffer: UniformBuffer
stencilFunc: StencilFunc
stencilMask: StencilMask
stencilOp: StencilOp
stencilTest: StencilTest
terrainUniformBuffer: UniformBuffer
viewport: Viewport

Methods

  • Parameters

    Returns void

  • Parameters

    • width: number
    • height: number
    • hasDepth: boolean
    • hasStencil: boolean

    Returns Framebuffer

  • Parameters

    • storageFormat: number
    • width: number
    • height: number

    Returns WebGLRenderbuffer

  • 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, TEXTURE0 and the three UNPACK_ 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's vertexAttribPointer calls cannot land on one of ours.

    Returns void

  • Returns void

  • Returns void

  • Returns void

Was this helpful?