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

Error compiling vertex shader when build on Emulator but it work Simulator

taqcuong1996 opened this issue · comments


 instagram: {
        frag: GLSL`
      precision highp float;
      varying vec2 uv;
      uniform sampler2D children;
      uniform float saturation;
      uniform float brightness;
      uniform float contrast;

 

      const vec3 W = vec3(0.2125, 0.7154, 0.0721);

      vec3 BrightnessContrastSaturation(vec3 color, float brt, float con, float sat)
      {
        vec3 black = vec3(0., 0., 0.);
        vec3 middle = vec3(0.5, 0.5, 0.5);
        float luminance = dot(color, W);
        vec3 gray = vec3(luminance, luminance, luminance);
        vec3 brtColor = mix(black, color, brt);
        vec3 conColor = mix(middle, brtColor, con);
        vec3 satColor = mix(gray, conColor, sat);
        return satColor;
      }


      void main() {
        vec2 st = uv.st;
        vec3 irgb = texture2D(children, st).rgb;
        vec3 filter = texture2D(children, st).rgb;

        vec3 bcs_result = BrightnessContrastSaturation(irgb, brightness, contrast, saturation);
     
        gl_FragColor = vec4(bcs_result, 1.);
      }
    `
    }

when i build with expo, on simulator it worked successfully, but run on emulator i got error.
Version of gl-react i am using is 3.15.0. Is it a bug ? Have any solution for it ? Please help me ! Thanks for reading !

Screen Shot 2019-04-03 at 2 26 30 PM

rename your filter variable to another name. seems reserved word in some GL implementation

I tried to renamed all variables in function BrightnessContrastSaturation() but it still not working. Can you show me exactly where i need to rename ???
And I'm using gl-react-expo. I'm not sure this error can from this ?

I tried again with code in Cookbook and it worked successfully. So i will close this issue, thanks for your help @gre