Skip to content

Instantly share code, notes, and snippets.

@DrewDahlman
Last active July 22, 2019 18:37
Show Gist options
  • Save DrewDahlman/775bb1b79878fafba1e3bbb2ea6c0d67 to your computer and use it in GitHub Desktop.
Save DrewDahlman/775bb1b79878fafba1e3bbb2ea6c0d67 to your computer and use it in GitHub Desktop.
class WebGL extends React.Component {
state = {
elements: [],
renderer: null,
scene: null
};
addImage = (image) => {
//.. Create Image texture & push into webgl context
}
// We wrap everything in our Effect context provider
render() {
const { children } = this.props;
const { elements, scene } = this.state;
return (
<EffectContext.Provider
value={{
elements: elements,
scene: scene,
addImage: this.addImage
}}
>
{children}
<WebGLRenderer />
</EffectContext.Provider>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment