1.0.3 • Published 10 years ago
@vaalentin/gl-shader v1.0.3
GL Shader
WebGL shader wrapper.
Installation
$ npm install --save @vaalentin/gl-shaderUsage
import Shader from '@vaalentin/gl-shader';
// setup canvas and gl
const vertexShader = new Shader(gl, gl.VERTEX_SHADER,
`
attribute vec3 aPos;
void main() {
gl_Position = vec4(aPos, 1.0);
}
`);API
shader = new Shader(gl, type, src)
Create a new shader, where:
glis the WebGL context.typeis the shader type:gl.VERTEX_SHADERorgl.FRAGMENT_SHADER.srcis the shader source, as astring.
shader.dispose()
Delete instance. Calls gl.deleteShader.
License
MIT, see LICENSE.md for more details.
Credits
Thanks to the amazing stackgl for the inspiration.