Last active
March 27, 2017 12:23
-
-
Save vorg/a1c1fe4f53d241cd6a86589f95ec4ecf to your computer and use it in GitHub Desktop.
pex-context command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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