jmacedo
jmacedo

Reputation: 783

OpenGL ES 2.0 GLSL texture2D return value when unbound

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?

Upvotes: 2

Views: 1629

Answers (1)

Graham McIntyre
Graham McIntyre

Reputation: 82

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

Upvotes: 1

Related Questions