DrawUsage

View source

Provides usage hints for WebGL buffer storage.

Pass a member to createBuffer or createBufferData as the buffer-usage argument. The hint describes how often the buffer data is expected to change and how often the buffer is expected to be used; it does not prevent later updates.

Examples

import { BufferType, DrawUsage, createBufferData } from '@wimaengine/render-webgl'

const positions = new Float32Array([0, 0, 0, 1, 0, 0, 0, 1, 0])
const vertexBuffer = createBufferData(
  gl,
  BufferType.Array,
  positions,
  DrawUsage.Static
)

Variants


Static

View source

Data is specified once and used many times (0x88E4, WebGL STATIC_DRAW).

Dynamic

View source

Data may be updated repeatedly and used many times (0x88E8, WebGL DYNAMIC_DRAW).

Stream

View source

Data is specified once and used a few times (0x88E0, WebGL STREAM_DRAW).