1.glsl4.5以上支持按位与运算吗
2.如何将int类型转换成float类型
3.转换效率在10xx系列以上的显卡来讲如何
题主悬赏了40铜
|
已采纳 amekikyou 的答案
how to cast 'int' into 'float' in glsl?
回答
-
https://stackoverflow.com/questions/1700871/how-do-i-perform-bit-operations-in-glsl
GLSL 1.30 (OGL 3.0)之后就可以了。需要注释。
https://stackoverflow.com/questions/33270823/how-to-cast-int-to-float-in-glsl-webgl
可以通过赋值给float变量来转义。implicit的是不允许的。
https://www.geeks3d.com/20120106/precise-qualifier-in-glsl-and-nvidia-geforce-cards/
谷歌一下你就知道……-
mastman429 @amekikyou 试了一下比较新的版本已经支持implicit convert了
-
层主 @mastman429 这样吗?
-
mastman429 @amekikyou 但是结果好像不对
-
-
难道我来到了stackoverflow么
glsl应该不支持bitwise的逻辑操作吧,类型强制转换试了下也不行。-
mastman429 @zermanni 你是哪个版本,我这编译没报错啊,好像手册里也加入了位操作,就是结果不对,不知道什么问题
-
层主 @mastman429 又试了下都可以,刚才其他地方写错了,用的WebGL 2.0测的,对应的glsl版本是es 3.0。
-
mastman429 @zermanni 是的,解决了,不知道效率如何
-
发表评论,请先 登录