All Projects → kevzettler → React Regl

kevzettler / React Regl

React Fiber Reconciler Renderer for Regl WebGL

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to React Regl

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 (+6740.94%)
Mutual labels:  webgl, glsl, shaders, 3d-graphics, glsl-shaders
Webgl Fundamentals
WebGL lessons that start with the basics
Stars: ✭ 3,315 (+1838.6%)
Mutual labels:  webgl, glsl, shaders, glsl-shaders
Wagner
Effects composer for three.js
Stars: ✭ 930 (+443.86%)
Mutual labels:  webgl, glsl, shaders
Month Of Shaders
One GLSL shader for every day of the month August
Stars: ✭ 12 (-92.98%)
Mutual labels:  webgl, glsl, shaders
Langterm
🕹️ WebGL-based VT220 emulator, made as a learning example and frontend for a text adventure
Stars: ✭ 35 (-79.53%)
Mutual labels:  webgl, glsl, shaders
Shader Doodle
A friendly web-component for writing and rendering shaders.
Stars: ✭ 356 (+108.19%)
Mutual labels:  webgl, glsl, shaders
Veda
⚡VJ / Live Coding on Atom⚡
Stars: ✭ 373 (+118.13%)
Mutual labels:  webgl, glsl, shaders
Awesome Creative Coding
Creative Coding: Generative Art, Data visualization, Interaction Design, Resources.
Stars: ✭ 8,696 (+4985.38%)
Mutual labels:  webgl, shaders, 3d-graphics
Blotter
A JavaScript API for drawing unconventional text effects on the web.
Stars: ✭ 2,833 (+1556.73%)
Mutual labels:  webgl, glsl, glsl-shaders
Glslcanvas
Simple tool to load GLSL shaders on HTML Canvas using WebGL
Stars: ✭ 1,067 (+523.98%)
Mutual labels:  webgl, glsl, shaders
Solarsys
Realistic Solar System simulation with three.js
Stars: ✭ 49 (-71.35%)
Mutual labels:  webgl, glsl, shaders
Glsl Godrays
This module implements a volumetric light scattering effect(godrays)
Stars: ✭ 155 (-9.36%)
Mutual labels:  webgl, glsl, shaders
Thebookofshaders
Step-by-step guide through the abstract and complex universe of Fragment Shaders.
Stars: ✭ 4,070 (+2280.12%)
Mutual labels:  glsl, shaders, glsl-shaders
Eternal
👾~ music, eternal ~ 👾
Stars: ✭ 323 (+88.89%)
Mutual labels:  webgl, glsl, 3d-graphics
Fsynth
Web-based and pixels-based collaborative synthesizer
Stars: ✭ 146 (-14.62%)
Mutual labels:  webgl, glsl, shaders
Pixi.js
The HTML5 Creation Engine: Create beautiful digital content with the fastest, most flexible 2D WebGL renderer.
Stars: ✭ 34,982 (+20357.31%)
Mutual labels:  webgl, glsl, renderer
YALCT
Yet Another Live Coding Tool - Powered by Veldrid and elbow grease
Stars: ✭ 25 (-85.38%)
Mutual labels:  shaders, glsl, glsl-shaders
MoravaEngine
2D/3D graphics engine written in C++ language. It currently supports the following graphics APIs: OpenGL 3.3+, Vulkan 1.2, DirectX 11. Its current purpose is to experiment with various CG concepts and techniques.
Stars: ✭ 129 (-24.56%)
Mutual labels:  shaders, glsl, 3d-graphics
Curtainsjs
curtains.js is a lightweight vanilla WebGL javascript library that turns HTML DOM elements into interactive textured planes.
Stars: ✭ 1,039 (+507.6%)
Mutual labels:  webgl, glsl, shaders
Glsl Worley
Worley noise implementation for WebGL shaders
Stars: ✭ 66 (-61.4%)
Mutual labels:  webgl, glsl, shaders

react-regl

This library enables Regl shader WebGL draw commands to be rendered directly as React components.

Stability npm version Dependency Status Build Status

Demos

View demos in the Storybook

There is a React Storybook included in the /docs directory with usage examples. The source for the Storybook is in the /stories directory and demonstrates how to create the examples.

Visit the Regl gallery page for more ideas on usage.

Install

npm install --save react-regl

Example Usage

import React from 'react'
import regl, { ReglFrame } from 'react-regl';

// Define a draw call for rendering a 2D triangle
const Triangle = regl({
  // Shaders in regl are just strings.  You can use glslify or whatever you want
  // to define them.  No need to manually create shader objects.

  vert: `
          precision mediump float;
          attribute vec2 position;
          void main () {
            gl_Position = vec4(position, 0, 1);
          }`,

  frag:`
          precision mediump float;
          uniform vec4 color;
          void main () {
            gl_FragColor = color;
          }`,

  // Here we define the vertex attributes for the above shader
  attributes:{
    position: [
      [-1, 0],
      [0, -1],
      [1, 1]
    ]
    // regl automatically infers sane defaults for the vertex attribute pointers
  },

  uniforms:{
    // This defines a dynamic regl value that can bethat can be passed as a react prop
    color: regl.prop('color')
  },

  // This tells regl the number of vertices to draw in this command
  count: 3
});

// Create an 'App' component that renders a regl frame and
// renders the triangle draw call
const App = () => {
  return (
    <ReglFrame>
      <Triangle color={[1, 0, 0, 1]} />
    </ReglFrame>
  );
};

// Mount React and render the App component
ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

Motivation and Goals

This repo, react-regl brings a JSX interface to regl, enabling easy integration of Regl UI into existing react projects. react-regl Allows you to render regl draw commands as react components. You can define the regl draw command as you would with raw regl but with react-regl you can pass arnd render it as react component.

regl is a stateless functional abstraction for WebGl. Regl makes working with WebGL a more productive experience. Its stateless nature makes it easier to reason about WebGL programs. Regl's design was influenced by React. It follows React's unidirectional data flow to stateless component model. This module wraps Regl with a React reconciler for a fuller React experience

Regl vs Other WebGL frameworks

Regl follows the unix philosophy of "small sharp tools" or "do one thing and do it well". Regl has full test coverage and aims for stable non-breaking updates. Other popular WebGL frameworks encompass much more responsiblity, usually including heavy abstractions for: scene graphs, animation systems, input systems, and cross device compatibility. The large amount of responsiblity in these other libraries leads to unstable, breaking releases, and lacking documentation and support.

Development

npm link and local installs npm i -S [email protected]:../react-regl should link to consuming project. npm run build should be run in the react-regl module directory

React peer dependency error

If default npm link or local install fails with od errors about duplicate react versions you need to ensure the module is loading react from the consuming host project

cd my-app
npm link ../react-regl

Link its copy of React back to the app's React

cd ../react-regl
npm link ../my-app/node_modules/react

Publishing

publish to npm with the version command and patch minor major or explicit tag 4.0.0-beta.2

npm version

npm version will create a git tag that needs to be pushed..

git push --tags

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].