Encoding 2 integers into RGBA without bitwise

I’m using Processing(Java) to write shaders that do lots of fancy code art. In my shader code I’m trying to get 2 integers (x,y positions) into an RGBA so I can send this colored pixel back to my Java program - and from there decode this color to get back the original integers. As far a I know, I cant use bitwise operations in GLSL, or least I’d have to re-write a lot of code. So I need to get 2 numbers into an RGBA, or 1 number into 2 bytes (RG) and the other in another 2 bytes (BA) - something like that… without bitwise… Help!!

1 Like

Remember too that processing parses int colours as ARGB (alpha is first 8 bits).

1 Like