I try to store integer (real numbers) values into pixel data. The only way my api can store pixel data are RGB Colors. The idea behind it is, to store a large amount of vertices into the vram, rather than into the ram and compare them. A RBG Color is created by rgb(r, g, b), where r, g and b can have 256 different values (0 - 255).
So i could theoretically store 256^3 values. The integer could be greater than that, but i dont need that high numbers.
My goal is to store for example:
integer 1 = rgb(1, 0, 0);
integer 2 = rgb(0, 1, 0);
My math understanding has slightly decreased the years after graduating, but im aware, that if im looping first through red, then green and at the end blue, i could only use 256*3 numbers.
Therefore my question is: how could i convert (or split) any real number below 256^3 into 3 variables (r, g, b).
No special languague syntax is required, but im happy with c or java syntax