React webgl canvas component
A React webgl canvas component that handles resizing and context loss.
Installation
Use npm to install:
npm install webgl-canvas
Usage
;; { // handle any initialization here. This function is called the first time // the component mounts. It will be called again if the webgl context is // lost and needs to be reinitialized (this is handled automatically by // the WebGLCanvas component) } { // render your scene! This function is called at 60fps by requestAmimationFrame } { return <WebGLCanvas dimensions= width: 500 height: 300 onSceneInitialized= this onSceneRender= this /> ; }
Copyright and License
Code and documentation copyright 2017 Jon Brennecke. Code released under the MIT license. Docs released under Creative Commons.