GLSL: Replace large uniform int array with buffer or texture

Viewed 6116

Right now I am trying to pass an array of ints into the fragment shader, and am doing this through a uniform array:

uniform int myArray[300];

And filling it outside the shader with glUniform1iv.

Unfortunately, uniform arrays larger than ~400 fail. I understand that I can use a "uniform buffer" instead, but can't seem to a find a full example of passing a large 1D array into a fragment shader with buffers or otherwise.

Could anyone supply such an example?

1 Answers
Related