OpenGL ES 2.0 GLSL texture2D return value when unbound

时光总嘲笑我的痴心妄想 提交于 2019-12-02 03:22:17

问题


In the following code:

gl_FragColor = vColor * texture2D(u_Texture, v_TexCoordinate);

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?


回答1:


I wouldn't have thought so.

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



来源:https://stackoverflow.com/questions/12570379/opengl-es-2-0-glsl-texture2d-return-value-when-unbound

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!