2

I'm making a shader in glsl.heroku.com and when I try to access an array of floats declared like this:

float colors[200];

in this way:

int i=function();
float color=colors[i];

it doesn't compile, a "compiled with errors" error appears. Is this because glsl doesn't allow it or is it a heroku specific problem? In the case it's the former, how can I work around it?

1 Answer 1

1

Ok I found the answer (well, the user kaoD solved it). heroku uses WebGL, which uses OpenGL ES 2.0, and it doesn't treat arrays as normal arrays, but more like separated variables, so it can't access them at runtime unless it's with a constant index.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.