In my program I use 2 textures: t0 and t1. t1 is additional, needed only in some cases:
.....
glActiveTexture ( GL_TEXTURE1 );
if ( mDisplayMode == EDM_DEFAULT ){
glBindTexture( GL_TEXTURE_2D, 0 ); // In this case I don't need t1
}else{
glBindTexture( GL_TEXTURE_2D, mglDegreeTexture ); // In this case t1 will overlap t0
}
shader->setUniformValue( "textureId1", 1 );
Shader for drawing:
.....
vec4 c1 = texture( textureId0, uv );
vec4 c2 = texture( textureId1, gridUV );
float a = c2.a;
gl_FragColor = ( 1.0 - a )*c1 + a*c2;
It's works fine: second texture overlap first when needed. Assuming that using glBindTexture( .. , 0 ) return zero texture (0,0,0,0), but after updating NVidia drivers to 314.07, my code procude black screen, like glBindTexture( .. , 0 ) return (0,0,0,1) texture.
I perform some test: With shader
....
vec4 c1 = texture( textureId0, uv );
vec4 c2 = texture( textureId1, gridUV );
float a = c2.a;
if (a == 1){
gl_FragColor = vec4(1,0,0,0);
return;
}
if ( a == 0){
gl_FragColor = vec4(0,1,0,0);
return;
}
gl_FragColor = ( 1.0 - a )*c1 + a*c2;
I get green screen on old driver (296, 306), and red on a new one. I tested it on 2 computers with Win 7 (GeForce 210) and win XP (GTX 260).
So my question is: It is correct to use glBindTexture with 0 as second parameter, and how I can achieve same result ( 0000 texture ) with a new driver?