Skip to content

Instantly share code, notes, and snippets.

View d954mas's full-sized avatar

Dmitry Popov d954mas

View GitHub Profile
@d954mas
d954mas / WebGLBitwiseFunctions.shader
Created October 22, 2023 09:10 — forked from EliCDavis/WebGLBitwiseFunctions.shader
In absence of bitwise operators in WebGL 1.0, I used these methods as substitute.
// CAUTION / / / CAUTION / / / CAUTION / / / CAUTION / / / CAUTION / / / CAUTION / / / CAUTION / / /
// Notice the for loops have a hardcoded values for how far they can go (32)
// This is a result of WEBGL not allowing while loops. Change the value to what you find appropriate!
// CAUTION / / / CAUTION / / / CAUTION / / / CAUTION / / / CAUTION / / / CAUTION / / / CAUTION / / /
//
// Hopefully this gives you the format for making your own operators such as XOR, NAND, etc.
//
// Adapted from this thread:
// https://scratch.mit.edu/discuss/topic/97026/