patriciogonzalezvivo/glslCanvas

glslCanvas error : Index expression must be constant

sixclones opened this issue · 4 comments

Hi,

I've found an issue when you want to dynamicly access to an index of an array.

vec2 p[9];

int i = 0;
for (float y = -1.0; y <= 1.0; y++) {
p[i++] = y; // The error says : Index expression must be constant
}

I test this code with glslViewer and that work well.

that's because the GLSL of WebGL is not exactly the same that the GLSL of OpenGL ES. Is not a problem of GlslCanvas but WebGL 1.0

Yeah I discovered that a bit later, sorry for the useless issue.

But do you have an idea why I can't reproduce the bug on Shadertoy (https://www.shadertoy.com/view/4ttfD8) ? In other words, why it's work there and not on native webgl ?

I think ShaderToy is using WebGL 2.0

It's what I tought too until I try by myself with webgl2 context and that didn't change anything.
This is a kinda weird.
I close the issue, sorry for the inconvenience.