Skip to content

Instantly share code, notes, and snippets.

@vorg
Last active March 27, 2017 12:23
Show Gist options
  • Select an option

  • Save vorg/a1c1fe4f53d241cd6a86589f95ec4ecf to your computer and use it in GitHub Desktop.

Select an option

Save vorg/a1c1fe4f53d241cd6a86589f95ec4ecf to your computer and use it in GitHub Desktop.
pex-context command
const createContext = require('pex-context')
const ctx = createContext({ width: 1280, height: 720})
const drawCmd = {
pass: ctx.pass({
clearColor: [0.5, 0.5, 0.5, 1],
clearDepth: 1
}),
pipeline: ctx.pipeline({
vert: vertSrc,
frag: fragSrc,
depthEnabled: true
}),
attributes: {
aPosition: ctx.vertexBuffer(cube.positions),
aTexCoord: ctx.vertexBuffer(cube.uvs)
},
indices: ctx.indexBuffer(cube.cells),
uniforms: {
uProjectionMatrix: camera.projectionMatrix,
uViewMatrix: camera.viewMatrix,
uModelMatrix: mat4.create(),
uTexture: ctx.texture2D(img)
}
}
ctx.submit(cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment