Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. const createContext = require('pex-context')
  2. const ctx = createContext({ width: 1280, height: 720})
  3.  
  4. const drawCmd = {
  5. pass: ctx.pass({
  6. clearColor: [0.5, 0.5, 0.5, 1],
  7. clearDepth: 1
  8. }),
  9. pipeline: ctx.pipeline({
  10. vert: vertSrc,
  11. frag: fragSrc,
  12. depthEnabled: true
  13. }),
  14. attributes: {
  15. aPosition: ctx.vertexBuffer(cube.positions),
  16. aTexCoord: ctx.vertexBuffer(cube.uvs)
  17. },
  18. indices: ctx.indexBuffer(cube.cells),
  19. uniforms: {
  20. uProjectionMatrix: camera.projectionMatrix,
  21. uViewMatrix: camera.viewMatrix,
  22. uModelMatrix: mat4.create(),
  23. uTexture: ctx.texture2D(img)
  24. }
  25. }
  26.  
  27. ctx.submit(cmd)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement