4 float color to one float in java, and back again in openGL ES 2.0 shader
问题 I am trying to send one color with every vertex that goes in to the shader, but in only one float value. I think is weird that you cannot send 4 bytes as attributes with every vertex, but sense it's not possible I am going to try to pack RGBA in a single float variable, so this is my code: Jave code (that packs the values in one float): private float fourfColor2One(float r, float g, float b, float a) { long temp = (byte) (r * 255); float res = temp << 24; temp = (byte) (g * 255); res += temp