Hello community,
some of you already know, i use Urho3D for mobile devices. This mean OpenGL ES, more specific OpenGL ES 2.0. I came from the pure OpenGL ES 3.0 world and i wrote all my shader code for the corresponding shader versions. I am now making everything downwards compatible (Using varyings again, etc…).
At one function i am not sure how to proof if this would work the modulo function. In my GLES 3 shader code (#version 300 es) i was able to call ‘a%b’. I saw this will not work with GLES 2 so i wanted to implement it myself.
int mod(int a, int b)
{
return a - (b * floor(a/b));
}
But there is no ‘floor’ or ‘round’ function as well so i did
int mod(int a, int b)
{
return a - (b * int(a/b));
}
Now i don’t know if this is valid shader code and i cannot test it in a fast way cause it is used in a very complex shader, maybe someone can tell me if this is valid and if not what are the alternatives?