webgl-sketch
Advanced tools
Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "webgl-sketch", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "A WebGL canvas—shader wrapper library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -26,2 +26,12 @@ # WebGL Sketch | ||
*(Coming soon)* | ||
### `create (options = {})` | ||
Instantiates a WebGL context on a canvas, and renders shaders to it.<br /> | ||
Options can include: | ||
- `canvas` *(optional)* – An existing canvas element to render into; if not supplied, a new canvas is created instead. | ||
- `dynamic` *(optional)* – A boolean, whether to animate dynamic rendering of the canvas, which sets the uniform float `u_time` each render; defaults to `false`. | ||
- `fragmentShaderSource` – GLSL shader source string to use as the fragment shader. | ||
- `size` *(optional)* – An array of `[width, height]` to size the canvas to; if not supplied, `[200, 200]` is used. | ||
- `uniforms` *(optional)* – An object to inject as uniforms into the fragment shader, using each key as the uniform name (e.g., `"name"` as `u_name`) and the value encoded based on type(s). | ||
- `vertexShaderSource` – GLSL shader source string to use as the vertex shader. |
@@ -21,3 +21,3 @@ const positions = new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]); | ||
const gl = canvas.getContext('webgl2', { | ||
const gl = canvas.getContext('webgl', { | ||
antialias: false, | ||
@@ -24,0 +24,0 @@ preserveDrawingBuffer: true |
6208
37