メインコンテンツまでスキップ

Basic API

Set gl config

const gl = createGL({ frag: `...` })

Set buffer object

// set uniform
gl.uniform('iTime', performance.now() / 1000) // or
gl.uniform({ iTime: performance.now() / 1000 })

// set attribute
gl.attribute('a_position', [-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]) // or
gl.attribute({ a_position: [-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1] })

Set mount and clean callback

// run when mount phase
gl('mount', () => {})

// run when clean phase
gl('clean', () => {})

more

Set frame callback

// Schedule an update
gl.queue((dt) => {})

// Start an update loop
gl.queue((dt) => true)

more