pex-gl / pex-context

Modern WebGL state wrapper for PEX: allocate GPU resources (textures, buffers), setup state pipelines and passes, and combine them into commands.
http://pex-gl.github.io/pex-context/
MIT License
160 stars 12 forks source link

Improve inline examples #36

Closed vorg closed 1 year ago

vorg commented 6 years ago

Before

var pass = ctx.pass({
  color: [Texture2D, ...]
  color: [{ texture: Texture2D | TextureCube, target: CubemapFace }, ...]
  depth: Texture2D
  clearColor: Array,
  clearDepth: Number
})

After

var depthMap = ctx.texture2D({ width: 128, height: 128, pixelFormat: ctx.PixelFormat.DEPTH })
var pass = ctx.pass({
  color: [ ctx.texture2D({}), ... ],
  color: [{ texture: ctx.textureCube({}), target: ctx.CubemapFace.PositiveX }, ...],
  depth: ctx.texture2D({}),
  depth: depthMap,
  clearColor: [1, 0, 0, 1],
  clearDepth: 1
})