I asked for help on the OpenGL ES 2.0 issue in this matter . It seems that the answer is very strange for me. So I decided to ask this question in the hope of understanding what was going on.
Here is a fragment of an erroneous vertex shader code:
// a bunch of uniforms and stuff... uniform int u_lights_active; void main() { // some code... for ( int i = 0; i < u_lights_active; ++i ) { // do some stuff using u_lights_active } // some other code... }
I know this looks weird, but this is really all the code that is needed to explain the problem / incorrect behavior.
My question is: why does the loop not execute when I pass some value greater than 0 for u_lights_active? When I hardcode an integer, for example. 4, instead of using uniform u_lights_active, it works fine.
One more thing, this only appears on Android, but not on the desktop. I use LibGDX to run the same code on both platforms.
If you need more information, you can look at the original question , but I do not want to copy and paste everything here. I hope that such an approach to its reduction will be appreciated, otherwise I will copy all this.
I look forward to explaining :)
Thanks!
source share