a-big-triangle

Draws a big triangle

npm install a-big-triangle
2 downloads in the last week
17 downloads in the last month

a-big-triangle

Draws a big triangle.

Example

var shell = require("gl-now")()
var drawTriangle = require("a-big-triangle")
var createShader = require("gl-shader")

var shader

shell.on("gl-init", function() {
  shader = createShader(shell.gl, 
  "attribute vec2 position;\
  varying vec2 uv;\
  void main() {\
    uv = position;\
    gl_Position = position;\
  }",
  "varying vec2 uv;\
  void main() {\
    gl_FragColor = vec4(uv, 0, 1);\
  }")
})

shell.on("gl-render", function() {
  shader.bind()
  drawTriangle(shell.gl)
})

Check it out in your browser

Install

npm install a-big-triangle

API

require("a-big-triangle")(gl)

Draws a fullscreen triangle.

  • gl is a WebGL context

Credits

(c) 2013

npm loves you