I just ran into something that is preventing me from passing a uniform array of integers to my shader as a VarType.IntArray
. For now I was able to get around this bug by using a FloatArray and casting my floats to an integer in the shader, but I thought I should still report this issue in case it’s a bug
Whenever I was using an array of integers, only the value at index [0] seems to hold its value after being passed to the shader. I tested this by looping through my array and printing out each integer value right before the line of code where I pass the IntArray to the shader. Based on this output, all of the integers in the array were returning the correct value I had just assigned on the java end of things.
So then I also looped through my values in the shader, displaying a different texture based on the integer value, and each integer above the [0] index appears to show the wrong texture, suggesting that the data is somehow different than what I set it to be prior to passing it to the shader.
I initially thought this was something I was doing by mistake, but after 2-3 hours of troubleshooting and ‘proof-reading’ my code with no success, I decided to just use a FloatArray and cast that to an integer in the shader and was surprised to find my data is now correct and consistent on both the Java and GLSL side of things.