What’s the fastest way to check whether an int is even in a shader in OpenGL ES 2? Best I have is “x / 2 * 2 == x”.
-
-
Alternatively, (n+1)/2 == n is only true for even numbers
-
I think you meant (n+1)/2 == n/2. Two divisions, so the original solution is more efficient.
- 1 more reply
New conversation -
-
-
Sorry, I misread your initial tweet, I was thinking floats. I don't know about ints but I hope it's stricter.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.