README.md 1.85 KB
Newer Older
1 2 3 4
# gl-react-native

`gl-react-native` implements OpenGL bindings for react-native.

Earle Castledine's avatar
Earle Castledine committed
5
It lets you implement complex effects over images and components, in the Virtual DOM descriptive paradigm.
6

Earle Castledine's avatar
Earle Castledine committed
7
More technically, `gl-react-native` allows you to write a [fragment shader](https://www.opengl.org/wiki/Fragment_Shader) that covers a View. The shader can render: generated graphics/demos, effects on top of images, effects over any UI content... anything you can imagine!
8

Earle Castledine's avatar
Earle Castledine committed
9
There's also a React version [`gl-react`](http://github.com/ProjectSeptemberInc/gl-react) with the same API.
10

Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
11 12
[![](docs/examples/simple.gif)](./Examples/Simple)[![](docs/examples/advancedeffects.gif)](./Examples/AdvancedEffects)

13 14
## Focus

Earle Castledine's avatar
Earle Castledine committed
15
- **Virtual DOM and immutable** paradigm: OpenGL is a low level imperative and mutable API. This library takes the best of it and exposes it in an immutable, descriptive way.
16
- **Performance**
Earle Castledine's avatar
Earle Castledine committed
17
- **Developer experience**: the application doesn't crash on bugs - it uses React Native error message to display GLSL errors, with Live Reload support to make experimenting with effects easy.
18
- **Uniform bindings**: The library implements binding from the JavaScript objects to the OpenGL GLSL language types (bool, int, float, vec2, vec3, vec4, mat2, mat3, mat4, sampler2D...)
Earle Castledine's avatar
Earle Castledine committed
19
- **Support for images** as a texture uniform.
20 21
- **Support for UIView rasterisation** as a texture uniform.

Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
22 23 24

## Installation

25
a few steps are required to install `gl-react-native`:
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
26

27
**Install the dependency from your React Native application:**
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
28 29 30 31 32

```
npm i --save gl-react-native
```

33
**Configure your React Native Application:**
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
34 35 36 37

![](docs/install-steps.png)


38
## Influence / Credits
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
39 40 41 42

- [stack.gl](http://stack.gl/) approach
- [GLSL.io](http://glsl.io/) and [Diaporama](https://github.com/gre/diaporama)
- Source code of [React Native](https://github.com/facebook/react-native)
43 44

## Documentation
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
45 46

![Index](./docs)