OpenGL ES 2.0 GLSL texture2D return value when unb

2019-02-28 10:55发布

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条回答
Luminary・发光体
2楼-- · 2019-02-28 11:37

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

查看更多
登录 后发表回答