All Projects → gre → Gl React

gre / Gl React

Licence: mit
gl-react – React library to write and compose WebGL shaders

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to Gl React

Sky Shader
☀️ WebGL sky and sun shader editor
Stars: ✭ 90 (-96.45%)
Mutual labels:  webgl, glsl
Sketch
Explorations on cross-hatching, engraving, and similar non-photorealistic rendering.
Stars: ✭ 136 (-94.64%)
Mutual labels:  webgl, glsl
Glsleditor
Simple WebGL Fragment Shader Editor
Stars: ✭ 1,345 (-46.96%)
Mutual labels:  webgl, glsl
Cezanne
This is a project showing varied shading algorithms with a simple apple.
Stars: ✭ 85 (-96.65%)
Mutual labels:  webgl, glsl
Gpu.js
GPU Accelerated JavaScript
Stars: ✭ 13,427 (+429.46%)
Mutual labels:  webgl, glsl
Threejs Starter
Stars: ✭ 89 (-96.49%)
Mutual labels:  webgl, glsl
Crossshader
⚔️ A tool for cross compiling shaders. Convert between GLSL, HLSL, Metal Shader Language, or older versions of GLSL.
Stars: ✭ 113 (-95.54%)
Mutual labels:  webgl, glsl
Graphics Snippets
Shading techniques and GLSL snippets
Stars: ✭ 53 (-97.91%)
Mutual labels:  webgl, glsl
Glsl Godrays
This module implements a volumetric light scattering effect(godrays)
Stars: ✭ 155 (-93.89%)
Mutual labels:  webgl, glsl
Twigl
twigl.app is an online editor for One tweet shader, with gif generator and sound shader, and broadcast live coding.
Stars: ✭ 145 (-94.28%)
Mutual labels:  webgl, glsl
3d Game Shaders For Beginners
🎮 A step-by-step guide to implementing SSAO, depth of field, lighting, normal mapping, and more for your 3D game.
Stars: ✭ 11,698 (+361.28%)
Mutual labels:  webgl, glsl
Vim Glsl
Vim runtime files for OpenGL Shading Language
Stars: ✭ 184 (-92.74%)
Mutual labels:  webgl, glsl
Glsl Worley
Worley noise implementation for WebGL shaders
Stars: ✭ 66 (-97.4%)
Mutual labels:  webgl, glsl
Medium
Progressive WebGL toolkit for art.
Stars: ✭ 90 (-96.45%)
Mutual labels:  webgl, glsl
Glsl Grid
Draws an antialiased grid along the X/Y/Z direction of a mesh.
Stars: ✭ 57 (-97.75%)
Mutual labels:  webgl, glsl
Three.meshline
Mesh replacement for THREE.Line
Stars: ✭ 1,644 (-35.17%)
Mutual labels:  webgl, glsl
Solarsys
Realistic Solar System simulation with three.js
Stars: ✭ 49 (-98.07%)
Mutual labels:  webgl, glsl
Glslcanvas
Simple tool to load GLSL shaders on HTML Canvas using WebGL
Stars: ✭ 1,067 (-57.93%)
Mutual labels:  webgl, glsl
Fsynth
Web-based and pixels-based collaborative synthesizer
Stars: ✭ 146 (-94.24%)
Mutual labels:  webgl, glsl
React Regl
React Fiber Reconciler Renderer for Regl WebGL
Stars: ✭ 171 (-93.26%)
Mutual labels:  webgl, glsl

Build Status npm

icon gl-react (v4)

gl-react is a React library to write and compose WebGL shaders. Implement complex effects by composing React components.

This universal library must be coupled with one of the concrete implementations:

Links

References

They use gl-react 🙂

Gist

import React from "react";
import { Shaders, Node, GLSL } from "gl-react";
const shaders = Shaders.create({
  helloBlue: {
    frag: GLSL`
precision highp float;
varying vec2 uv;
uniform float blue;
void main() {
  gl_FragColor = vec4(uv.x, uv.y, blue, 1.0);
}`
  }
});
class HelloBlue extends React.Component {
  render() {
    const { blue } = this.props;
    return <Node shader={shaders.helloBlue} uniforms={{ blue }} />;
  }
}

import the correct implementation,

import { Surface } from "gl-react-dom"; // for React DOM
import { Surface } from "gl-react-expo"; // for React Native via Expo GLView
import { Surface } from "gl-react-native"; // for React Native
import { Surface } from "gl-react-headless"; // for Node.js!

and this code...

<Surface width={300} height={300}>
  <HelloBlue blue={0.5} />
</Surface>

...renders:

Features

  • React, VDOM 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 with React.
  • React lifecycle allows partial GL re-rendering. Only a React Component update will trigger a redraw. Each Node holds a framebuffer state that get redrawn when component updates and schedule a Surface reflow.
  • Developer experience
    • React DevTools works like on DOM and allows you to inspect and debug your stack of effects.
  • Uniform bindings: bindings from JavaScript objects to OpenGL GLSL language types (bool, int, float, vec2, vec3, vec4, mat2, mat3, mat4, sampler2D...)
  • An extensible texture loader that allows to support any content that goes in the shader as a sampler2D texture.
    • support for images
    • support for videos (currently gl-react-dom)
    • support for canvas (gl-react-dom)
  • flowtype support.
  • Modular, Composable, Sharable. Write shaders once into components that you re-use everywhere! At the end, users don't need to write shaders.

Atom nice GLSL highlighting

If you are using Atom Editor, you can have JS inlined GLSL syntax highlighted.

To configure this:

  • add language-babel package.
  • Configure language-babel to add GLSL:source.glsl in settings "JavaScript Tagged Template Literal Grammar Extensions".
  • (Bonus) Add this CSS to your Atom > Stylesheet:
/* language-babel blocks */
atom-text-editor::shadow .line .ttl-grammar {
  /* NB: designed for dark theme. can be customized */
  background-color: rgba(0, 0, 0, 0.3);
}
atom-text-editor::shadow .line .ttl-grammar:first-child:last-child {
  display: block; /* force background to take full width only if ttl-grammar is alone in the line. */
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].