((X & 0x1) == 0) ?
-
-
-
No bitwise ops in ES2
End of conversation
New conversation -
-
-
I don't know opengl at all, but there's no modulus? or bitwise operators?
-
Only in OpenGL ES3+.
- 2 more replies
New conversation -
-
-
I think that some shader compilers will optimize out "n * k / k" into just "k"
-
Sorry, I meant just "n" obviously
- 4 more replies
New conversation -
-
-
A useful tool for figuring out what actual operations might happen given your clever math: http://bit.ly/2wspy1o
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Looking at the available operators, seems you're stuck with that. I'd imagine the HW optimizes division by powers of 2, so not awful.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Tempted by "x*2147483648==0" which we could potentially optimize down to !(x&1). assumes 32b ints, not guaranteed but may always be true.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
`mod(x, 2.0) == 0.0` should work Credit: https://stackoverflow.com/questions/19557217/how-to-determine-even-odd-line-of-a-texture-in-glsl-es …
-
That could be the best solution if mod() maps to a single floating point operation, such as FPREM1. May be implementation-dependent.
End of conversation
New conversation -
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.