Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/simple-2d-shader
A simple 2D shader
https://github.com/mikolalysenko/simple-2d-shader
Last synced: about 2 months ago
JSON representation
A simple 2D shader
- Host: GitHub
- URL: https://github.com/mikolalysenko/simple-2d-shader
- Owner: mikolalysenko
- License: mit
- Created: 2013-06-21T21:36:48.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-06-21T21:47:11.000Z (over 11 years ago)
- Last Synced: 2024-10-20T14:27:56.412Z (2 months ago)
- Language: JavaScript
- Homepage: http://mikolalysenko.github.io/simple-2d-shader/
- Size: 309 KB
- Stars: 6
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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](http://mikolalysenko.github.io/simple-2d-shader/)
```javascript
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:
## 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