Socket
Book a DemoInstallSign in
Socket

simple-2d-shader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-2d-shader

A simple 2D shader

latest
Source
npmnpm
Version
0.0.0
Version published
Maintainers
1
Created
Source

simple-2d-shader

A 2D webgl shader with a varying color attribute

TODO: Need to add more documentation and extra configuration stuff

Example

Try this example in your browser

var shell = require("gl-now")()
var createBuffer = require("gl-buffer")
var createSimpleShader = require("simple-2d-shader")

var shader, buffer

shell.on("gl-init", function() {
  var gl = shell.gl
  
  shader = createSimpleShader(gl)
  
  buffer = createBuffer(gl, [ 0, -1, -1, 0, 1, 1 ])
})

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

  buffer.bind()
  shader.attributes.position.pointer()
  shader.attributes.position.enable()

  shader.attributes.color = [1, 1, 0]

  buffer.draw(shell.gl.TRIANGLES, 3)
})

Here is a screen shot:

<img src=https://raw.github.com/mikolalysenko/simple-2d-shader/master/images/simple2dshader.png>

Install

npm install simple-2d-shader

API

var shader = require("simple-2d-shader")(gl)

Creates a simple 2D shader

Credits

(c) 2013 Mikola Lysenko. MIT License

Keywords

webgl

FAQs

Package last updated on 21 Jun 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts