regl-project / regl

👑 Functional WebGL
MIT License
5.19k stars 320 forks source link

Float Array Uniform cannot be used in version 2.1 #635

Open Jo-Song opened 2 years ago

Jo-Song commented 2 years ago

Float Array Uniform was not available in version 2.1.0, but it works fine in version 1.4.2. I do not know why?

const drawTexture = regl({
  ...computeBase,

  frag: `
        precision mediump float;

        uniform sampler2D buffer;
        uniform float plasma[2];
        uniform float maxi;

        varying vec2 uv;

        void main() {

          gl_FragColor = vec4(plasma[0],plasma[1],1.0, 1.0);

        }`,

  uniforms: {
    buffer: regl.prop<any, "buffer">("buffer"),
    maxi: regl.prop<any, "maxi">("maxi"),
    "plasma[0]": 0.98,
    "plasma[1]": 0.99,
  },
});
rreusser commented 2 years ago

You might have to trace it back through a particular bug reproduction, but I believe this was reverted in https://github.com/regl-project/regl/pull/612 due to a bug reported in https://github.com/regl-project/regl/issues/611. I don't happen to know the particular cause, though I believe there was some ambiguity discussed in https://github.com/regl-project/regl/issues/258.