STATUS: project is being rewritten from scratch in https://github.com/gre/gl-react. It will be the next v3.
Gitbook documentation / Github / live demos / gl-react-dom / gl-react-native / #gl-react on reactiflux
gl-reactWebGL/OpenGL bindings for React to implement complex effects over images and content, in the descriptive VDOM paradigm.
gl-react
allows you to write a fragment shader that covers a component. The shader can render: generated graphics/demos, effects on top of images, effects over content (video, canvas)... anything you can imagine!
gl-react
is the universal library that have 2 implementations:
gl-react-dom
for React DOM (web using WebGL).gl-react-native
for React Native (iOS and Android using OpenGL).The library gl-react
share most of the common code and exposes { Node, Uniform, Shaders, createComponent }
.
Both gl-react-dom
and gl-react-native
depends on gl-react
and exposes the { Surface }
implementation.
you want to experiment / show us some code?
you can fork this JSFiddle:
https://jsfiddle.net/greweb/bztz8494/
Open Examples page / Read the code.
react-motion
.react-canvas
.<video/>
tag.<video>
! It demonstrates the "shared computation" of the rendering tree introduced by 1.0.0.gl-react
(published on NPM)
const GL = require("gl-react"); const React = require("react"); const shaders = GL.Shaders.create({ helloGL: { frag: ` precision highp float; varying vec2 uv; uniform float blue; void main () { gl_FragColor = vec4(uv.x, uv.y, blue, 1.0); }` } }); module.exports = GL.createComponent( ({ blue }) => <GL.Node shader={shaders.helloGL} uniforms={{ blue }} />, { displayName: "HelloGL" });
const { Surface } = require("gl-react-dom"); // in React DOM context const { Surface } = require("gl-react-native"); // in React Native context
<Surface width={511} height={341}> <HelloGL blue={0.5} /> </Surface>
renders
gl-react-native
's version uses React Native error message to display GLSL errors).<canvas>
, <video>
as a texture uniform.gl-react
primary goal is not to do 3D. The library currently focus on stacking fragment shaders (that runs with static vertex) and exposes these features in a simple API applying React paradigm. This already unlock a lot of capabilities shown in the examples.
3D graphics implies more work on vertex shader and vertex data. We might eventually implement this. In the meantime, if this is a use-case for you, feel free to comment on this issue.
gl-shader
, gl-texture2d
, gl-fbo
are library directly used by gl-react-dom
)RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4