Older versions of GLSL don't support using variables as an array index. But as specified in the GLES specification in The Appendix, section 4
for loops are supported but with the following restrictions:
• There is one loop index.
• The loop index has type int or float.
• The for statement has the form:
for ( init-declaration ; condition ; expression ) statement
• init-declaration has the form:
type-specifier identifier = constant-expression
Consequently the loop variable cannot be a global variable
And in section 4
The following are constant-index-expressions:
• Constant expressions
• Loop indices as defined in section 4
• Expressions composed of both of the above
Variables
• Support for indexing with a constant-index-expression is mandated.
• Support for indexing with other values is not mandated.
So I changed the default shader to loop until it reaches the desired texture (or mask) id and to use the loop index (named i) for the tid and than to break.
It does hurt performance a bit, but at least for me compatibility is more important than perfect performance.
This is a fix for Issue #41
Older versions of GLSL don't support using variables as an array index. But as specified in the GLES specification in The Appendix, section 4
And in section 4
So I changed the default shader to loop until it reaches the desired texture (or mask) id and to use the loop index (named i) for the tid and than to break.
It does hurt performance a bit, but at least for me compatibility is more important than perfect performance.