How to deal with etc1 alpha channel

时间:2015-06-26 09:35:39

标签: android c++ alpha

I'm trying to support ETC1 for my android game but I have no idea how to deal with the alpha channel.

Can anyone tell me where to start and how to get ETC1 working with alpha?

Update: Using: gl_fragColor = vec4(tex1.rgb,tex2.a);

doesn't work, there is still a black rectangle around my texture

1 个答案:

答案 0 :(得分:0)

您需要使用alphamask着色器。

基本上没有包含透明度的全色信息的1个纹理,rgb(etc1)有1个纹理,alpha有1个纹理(也可以是etc1)。

然后在片段着色器中,从第一个纹理分配rgb,从第二个纹理分配alpha。

 gl_fragColor = vec4(tex1.rgb,tex2.a);

!注意上面的代码只是用于解释方法,语法可能是错误的。