Allocates a texture with specified dimensions and format without initial data. This creates an empty texture that can be filled later or used as a render target.
Texture allocation parameters
Internal texture format
Texture height in pixels
Number of mipmap levels to allocate
Texture width in pixels
The texture resource handle
Attaches a specific face of a cube texture as a color buffer to a framebuffer. This enables rendering to individual faces of cube textures.
The target framebuffer
Color attachment index (0-based)
Cube face index (0-5)
Mipmap level to attach
The cube texture to attach
Attaches a specific layer of a texture array as a color buffer to a framebuffer. This enables layered rendering to texture arrays.
The target framebuffer
Color attachment index (0-based)
The texture array to attach
Index of the layer to attach
Mipmap level to attach
Attaches a color buffer (texture or renderbuffer) to a framebuffer object. This allows the framebuffer to render color data to the attached buffer.
The target framebuffer
Color attachment index (0-based)
The color buffer to attach
Attaches a depth buffer to a framebuffer object. The depth buffer stores per-pixel depth information for depth testing.
The target framebuffer
The depth buffer to attach
Attaches a combined depth-stencil buffer to a framebuffer object. This is more efficient than separate depth and stencil buffers when both are needed.
The target framebuffer
The depth-stencil buffer to attach
Attaches a stencil buffer to a framebuffer object. The stencil buffer enables stencil testing for advanced rendering effects.
The target framebuffer
The stencil buffer to attach
Clears the framebuffer associated with the given render pass. This operation clears color, depth, and/or stencil buffers as configured in the render pass.
The render pass containing clear configuration
Creates a compressed texture from pre-transcoded texture data. This method handles already transcoded compressed texture data for multiple mipmap levels.
Array of texture data for each mipmap level
The specific compression format type
Promise resolving to the texture resource handle
Creates a compressed texture from a Basis Universal file. Basis Universal provides efficient texture compression that can be transcoded to various GPU-specific formats at runtime.
The Basis Universal file containing compressed texture data
Texture creation parameters
Border width (typically 0)
Target pixel format after transcoding
Component data type
The texture resource handle
Creates a cube texture from provided image data for all six faces. This method assembles a complete cube texture from individual face images.
Number of mipmap levels to generate
Array of image data objects, each containing all six cube faces
Width of each cube face in pixels
Height of each cube face in pixels
Tuple containing [texture handle, sampler]
Creates a cube texture from image files with automatic loading. This method handles the loading and assembly of 6 cube faces from file sources.
Base URI for the cube texture files
Number of mipmap levels to generate
Whether to use positive/negative naming convention
HDRI format specification for high dynamic range textures
Promise resolving to a tuple of [texture handle, sampler]
Creates an index buffer from an accessor containing index data. Index buffers are used to define the order in which vertices are processed.
Accessor containing index data and metadata
The index buffer resource handle
Creates a renderbuffer for use as a framebuffer attachment. Renderbuffers are optimized for use as render targets but cannot be sampled as textures.
Renderbuffer width in pixels
Renderbuffer height in pixels
Internal format of the renderbuffer
Whether to enable multi-sample anti-aliasing
Number of MSAA samples (if MSAA is enabled)
The renderbuffer resource handle
Creates a render target texture for off-screen rendering. This texture can be used as a color attachment in framebuffers for rendering operations.
Render target creation parameters
Internal texture format
Texture height in pixels
Number of mipmap levels
Texture width in pixels
The render target texture resource handle
Creates a render target texture array for layered rendering. This allows rendering to multiple texture layers in a single pass.
Render target array creation parameters
Number of texture layers
Pixel data format
Texture height in pixels
Internal texture format
Mipmap level
Component data type
Texture width in pixels
The render target texture array resource handle
Creates a render target cube texture for environment mapping and shadow mapping. This allows rendering to all six faces of a cube texture.
Render target cube creation parameters
Internal texture format
Texture height in pixels
Number of mipmap levels
Texture width in pixels
The render target cube texture resource handle
Creates a shader program from vertex and fragment shader source code. This method compiles, links, and validates the shader program for use in rendering.
Shader program creation parameters
Names of vertex attributes
Semantic meanings of vertex attributes
Fragment shader source code
Material that will use this shader program
Optional
onOptional error callback for compilation/linking errors
Primitive geometry that will be rendered with this shader
Vertex shader source code
The shader program resource handle
Creates a texture array from provided image data. Texture arrays allow efficient rendering of multiple related textures.
Texture width in pixels
Texture height in pixels
Number of textures in the array
Number of mipmap levels
Internal texture format
Pixel data format
Component data type
The texture data as a typed array
The texture array resource handle
Creates a texture from a data URI string. This method decodes base64-encoded image data and creates a GPU texture.
The data URI string containing encoded image data
Texture creation parameters
Border width (typically 0)
Pixel data format
Whether to automatically generate mipmaps
Internal texture format for GPU storage
Mipmap level (typically 0 for base level)
Component data type
Promise resolving to the texture resource handle
Creates a texture from an HTML image element with specified parameters. This method handles the conversion of HTML image elements to GPU textures.
The HTML image element containing the texture data
Texture creation parameters
Border width (typically 0)
Pixel data format
Whether to automatically generate mipmaps
Texture height in pixels
Internal texture format for GPU storage
Mipmap level (typically 0 for base level)
Component data type
Texture width in pixels
Promise resolving to the texture resource handle
Creates a texture from image bitmap data with specified parameters. This method handles various image sources and converts them to GPU textures.
The source image data (HTMLImageElement, HTMLVideoElement, etc.)
Texture creation parameters
Border width (typically 0)
Pixel data format
Whether to automatically generate mipmaps
Texture height in pixels
Internal texture format for GPU storage
Mipmap level (typically 0 for base level)
Component data type
Texture width in pixels
Promise resolving to the texture resource handle
Creates a texture sampler with specified filtering and wrapping parameters. Samplers define how textures are filtered and addressed during rendering.
Sampler creation parameters
Whether to enable anisotropic filtering
Optional
isWhether the texture uses premultiplied alpha
Magnification filter mode
Minification filter mode
Whether to enable shadow comparison mode
Texture wrapping mode for R coordinate
Texture wrapping mode for S coordinate
Texture wrapping mode for T coordinate
The texture sampler resource handle
Creates a vertex buffer from an accessor containing vertex data. The accessor provides metadata about the data layout and type information.
Accessor containing vertex data and metadata
The vertex buffer resource handle
Creates both vertex and index buffers for a primitive geometry. This is a convenience method that handles the creation of all necessary buffers for rendering a geometric primitive.
The primitive geometry containing vertex and index data
Object containing handles for all created vertex-related resources
Creates a vertex buffer directly from a typed array. This is a more direct approach when you have raw vertex data without accessor metadata.
The typed array containing vertex data
The vertex buffer resource handle
Deletes all vertex-related resources (vertex buffers, index buffers, VAOs). This method ensures proper cleanup of all resources associated with vertex data.
Object containing handles to all vertex-related resources to delete
Generates mipmaps for a 2D texture. Mipmaps improve rendering quality and performance by providing pre-filtered texture versions.
Handle to the texture
Base texture width in pixels
Base texture height in pixels
Generates mipmaps for a cube texture. This creates mipmaps for all six faces of the cube texture.
Handle to the cube texture
Base texture width in pixels
Base texture height in pixels
Reads pixel data from a texture attached to a framebuffer. This allows CPU access to rendered texture data for analysis or processing.
Handle to the texture to read from
Width of the region to read
Height of the region to read
Handle to the framebuffer containing the texture
Index of the color attachment to read from
Promise resolving to the pixel data as a Uint8Array
Loads image data to a specific mipmap level of an existing texture. This method allows for partial texture updates and mipmap level management.
Image loading parameters
The actual image data as a typed array
Format of the source image data
Height of the image data to copy
Target mipmap level
Size of each row in pixels
Handle to the target texture
Data type of the source image
Width of the image data to copy
X offset within the texture for the copy region
Y offset within the texture for the copy region
Configures the graphics pipeline with vertex data for rendering. This method sets up the vertex array object (VAO) and binds the necessary buffers.
Object containing buffer handles
Optional
iboIndex Buffer Object handle (optional)
Vertex Array Object handle
Array of Vertex Buffer Object handles
The primitive geometry defining vertex layout
Handle to instance ID buffer for instanced rendering
Sets the viewport for rendering operations. The viewport defines the area of the framebuffer that will be rendered to.
Optional
viewport: Vector4Optional viewport rectangle as [x, y, width, height]. If not provided, uses full framebuffer
Updates an existing index buffer with new data from an accessor. This allows for dynamic modification of index data without recreating the buffer.
Accessor containing the new index data
Handle to the existing index buffer to update
Updates an existing vertex buffer with new data from an accessor. This allows for dynamic modification of vertex data without recreating the buffer.
Accessor containing the new vertex data
Handle to the existing vertex buffer to update
Updates both vertex and index buffers for a primitive geometry. This is a convenience method for updating all vertex-related data at once.
The primitive geometry containing updated vertex and index data
Object containing handles to the buffers to update
Interface defining the contract for Computer Graphics API Resource Repository implementations. This interface abstracts graphics resource management operations across different APIs (WebGL, WebGPU). Implementations handle creation, management, and deletion of graphics resources like textures, buffers, shaders, and framebuffers.