webgl-classes
ES6 Wrapper Classes for WebGL
Last updated 4 years ago by krisselden .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install webgl-classes 
SYNC missed versions from official npm registry.

WebGL ES6 Classes

Instead of using objects like handles

let program = ctx.createProgram();
ctx.attachShader(program, vertexShader);
ctx.attachShader(program, fragmentShader);
ctx.linkProgram(program);
if (!ctx.getProgramParameter(program, ctx.LINK_STATUS) {
  let log = ctx.getProgramInfoLog(program);
  throw new Error(log);
}

Use them like objects

let vertexShader = ctx.createShader();
vertexShader.shaderSource(vsSrc);
vertexShader.compile();
if (!vertextShader.isCompiled) {
  let log = vertextShader.getInfoLog();
  vertextShader.delete();
  throw new Error(log);
}

let fragmentShader = ctx.createShader();
fragmentShader.shaderSource(fsSrc);
fragmentShader.compile();
if (!fragmentShader.isCompiled) {
  let log = fragmentShader.getInfoLog();
  fragmentShader.delete();
  throw new Error(log);
}

let program = ctx.createProgram();
program.attachShader(vertexShader);
program.attachShader(fragmentShader);
program.link();
if (!program.isLinked) {
  let log = program.getInfoLog();
  throw new Error(log);
}

program.validate()
program.isValid //= true

or

let program = ctx.compileAndLinkProgram(vsSrc, fsSrc);
program.validate()
program.isValid //= true

Current Tags

  • 0.0.1                                ...           latest (4 years ago)

1 Versions

  • 0.0.1                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 2
Last Month 1
Dependencies (19)
Dev Dependencies (14)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |