I'm building a shader program to render a simple bitmap font in GLSL.
My programming environment is C# so I'm using OpenTK to encapsulate OpenGL 4.0, but the syntax is very similar to any examples in C and C++.
My issue is that I'm trying to pass an array of integers to the fragment shader, but whenever I do, all the array elements end up being zero. The integers should range between 0 and 255 and I've checked the values before and after sending them. It's infuriating.
Currently I'm binding my program, then attempting to send the int[] array to the shader using the following instructions:
int[] ints = new int[] { 33, 34, 35, 36, 37, 38, 39, 40 };
GL.UseProgram(programLocation);
GL.Uniform1(arrayLocation, ints.Length, ints);
My fragment shader takes the array and uses a couple of functions to determine which part of the quad to place which characters. I've tested these functions with static numbers and arrays I build manually in the shader and they work just as I'd expect them to. For some reason the syntax above simply doesn't actually end up sending any data - all elements evaluate to 0.
In my shader, the array is denoted and used like this:
uniform int characters[8];
....
gl_FragColor = texture2D(bitmapFontTex, GetBitmapFontStart(characters[0...8etc]));
The rest of my code seems to work when tested in isolation - it only falls apart when it comes together, and the above code blocks are where it comes together. Have I made some silly rookie mistake, or is there something more screwy happening? Any help greatly appreciated.
arrayLocation
is right \$\endgroup\$