我正在尝试将一些opengl glsl转换为opengl es(2.0)glsl。我将字节值传递到片段着色器中,方法是将其强制转换为代码中的float,然后将其强制转换回着色器中。然后,我需要将结果分成0-15之间的两个值。对于opengl glsl我正在使用
int x = int(a_otherdata);
int a = (x >> 4) & 0xF;
int b = x & 0xF;
Run Code Online (Sandbox Code Playgroud)
但是,由于opengl es不支持按位操作,因此我尝试执行以下操作,但是它不起作用。
int x = int(a_otherdata);
int a = x / 16;
int b = x - (a * 16);
Run Code Online (Sandbox Code Playgroud)