gre / gl-react

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

Home Page:https://gl-react-cookbook.surge.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android crashing - compilation error

farazirfan47 opened this issue · comments

BUG

library version

├── gl-react@4.0.1 
└── gl-react-expo@4.0.1

Expected behavior

Should see blue shaded view in android

Actual behavior

Always crashing and getting this error:

gl-shader: Error compiling shader:
Compile failed.
ERROR: 0:1: '' :   Invalid directive 5
1 compilation errors. No code generated.

Steps to reproduce the behavior

Anytime I run code I got compilation error, see sample code below

import React from "react";
import { Shaders, Node, GLSL } from "gl-react";
import { Surface } from "gl-react-expo"; // for React Native via Expo GLView
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 }} />;
  }
}

export default class GLTest extends React.Component{
    render(){
        return(
            <Surface style={{width: 300, height: 500}}>
                <HelloBlue blue={0.5} />
            </Surface>
        )
    }
}

what is the error?

@gre just updated bug info

@gre here is full screenshot
Screenshot_20200604-155829

error: Error: Unable to resolve module buffer from node_modules/typedarray-pool/pool.js: buffer could not be found within the project.

I'm not exactly sure but you could try to remove the "precision highp float;" @farazirfan47