# litegl

> This is a fork of https://github.com/jagenjo/litegl.js to get it working as node module

Latest version **0.1.0** (published 2016-01-13) · SEE LICENSE IN <LICENSE> license · 0 weekly downloads

## Install

```sh
npm install litegl
pnpm add litegl
yarn add litegl
bun add litegl
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-01-13 |
| First published | 2016-01-13 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN <LICENSE> |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Julio Manuel López |
| Maintainers | pixelements |
| Keywords | litegl |

## Links

- npm: https://www.npmjs.com/package/litegl
- Repository: https://github.com/julio-pixelements/litegl
- Homepage: https://github.com/julio-pixelements/litegl#readme
- Issues: https://github.com/julio-pixelements/litegl/issues
- npm.io page: https://npm.io/package/litegl

## Dependencies (3)

- [webpack](https://npm.io/package/webpack.md) ^1.12.11
- [gl-matrix](https://npm.io/package/gl-matrix.md) ^2.3.1
- [source-map-loader](https://npm.io/package/source-map-loader.md) ^0.1.5

## Recent versions

- 0.1.0 (latest) — 2016-01-13
- 0.0.5 — 2016-01-13
- 0.0.4 — 2016-01-13
- 0.0.3 — 2016-01-13
- 0.0.2 — 2016-01-13
- 0.0.1 — 2016-01-13

## README

# litegl
Litegl is a library that wraps WebGL to make it more user-friendly by creating classes for managing different items like Buffer, Mesh, Texture, Shader and other common aspects of any WebGL applications. It is a fork from [Litegl.js](https://github.com/jagenjo/litegl.js) by [Javier Agenjo](https://github.com/jagenjo) but with some changes.
with some modifications to get it working as npm package.

[Litegl.js](https://github.com/jagenjo/litegl.js) by [Javier Agenjo](https://github.com/jagenjo) is a fork from [LightGL.js](https://github.com/evanw/lightgl.js/) by [Evan Wallace](http://madebyevan.com), but some major changes have been made.
Some of the main differences:

 * Matrices have been replaced by glMatrix
 * Meshes are forced to be stored in ArrayBuffer formats
 * Meshes support range rendering with offset
 * Removed fixed pipeline behaviour
 * Better event handling (mouse position, mouse wheel, dragging)
 * Textures expanded to support Arraybuffers and Cubemaps
 * Events system to trigger events from any object
 * Support for multiple WebGL contexts in the same page

[Litegl.js](https://github.com/jagenjo/litegl.js) by [Javier Agenjo](https://github.com/jagenjo) library has been used in several projects like [Rendeer.js](https://github.com/jagenjo/rendeer.js) or [Canvas2DtoWebGL](https://github.com/jagenjo/Canvas2DtoWebGL).</p>


Demos
-----
Demos are included in the Examples folder.

Usage
-----

```
npm install --save litegl
```

Create the context
```js
var GL = require("litegl")
var gl = GL.create({width:800, height:600});
```

Attach to DOM
```js
document.getElementById("mycontainer").appendChild( gl.canvas )
```

Compile shader
```js
var shader = new GL.Shader( vertex_shader_code, fragment_shader_code );
```

Create Mesh
```js
var mesh = new GL.Mesh({vertices:[-1,-1,0, 1,-1,0, 0,1,0], coords:[0,0, 1,0, 0.5,1]});
```

Load a texture
```js
var texture = GL.Texture.fromURL("image.jpg", { minFilter: gl.LINEAR_MIPMAP_LINEAR });
```


Render
```js
gl.ondraw = function() {
	texture.bind(0);
	var my_uniforms = { u_texture: 0, u_color: [1,1,1,1] };
	shader.uniforms( my_uniforms ).draw( mesh );
}

gl.animate(); //calls the requestAnimFrame constantly, which will call ondraw
```

Feedback
--------

You can write any feedback to julio@pixelements.net

---
_Source: https://npm.io/package/litegl · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
