取消绑定时,OpenGL ES 2.0 GLSL texture2D返回值 [英] OpenGL ES 2.0 GLSL texture2D return value when unbound
本文介绍了取消绑定时,OpenGL ES 2.0 GLSL texture2D返回值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在以下代码中:
gl_FragColor = vColor * texture2D(u_Texture, v_TexCoordinate);
我注意到,如果u_Texture未绑定,则Texture2D返回的默认值为白色(1,1,1,1).
I noticed the default value returned by texture2D is a white (1,1,1,1) if u_Texture is unbound.
将着色器基于此事实是否安全?
Is it safe to base my shader on this fact?
推荐答案
我不会这么想.
我看到过其他默认值为黑色的实例.如果采样器使用的内存是未初始化的视频内存的一部分,则理论上它可以是任何颜色,这取决于opengl的实现
I have seen other instances where the default value has been black. It could theoretically be any colour in the case where the memory used by the sampler is a section of uninitialised video memory, it depends on the opengl implementation
这篇关于取消绑定时,OpenGL ES 2.0 GLSL texture2D返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文