小编vaw*_*165的帖子

OpenGL ES glsl按位运算等效项

我正在尝试将一些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)

bit-manipulation opengl-es glsl glsles

2
推荐指数
1
解决办法
1785
查看次数

标签 统计

bit-manipulation ×1

glsl ×1

glsles ×1

opengl-es ×1