0

I want to render a scene and blend the material color with the texture. i am using programmable pipeline and GLSL, when the function texture() is called, all the portion of the meshes wish dont have texture become transparent. (even if i dont use the vec4 in the final fragColor)

look in the screeshots below, in the first image i have only the material color, in the second the applied texture, but the faces with only material color become transparent..

in my fragment shader, i have something like that:

vec4 tex = texture(texsampl,fTexCoord);
fFragColor = ambient + (diffuse*tex)  + specular;
Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
bruchuck
  • 13
  • 2

1 Answers1

0

only material color become transparent.

Well, you're adding the values, that's what to be expected. You should instead use some blending function like mix (= s*a + d*(1-a) where s and d are material and texture and a is some blending factor) or slerp.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • the diffuse, specular and ambinet component is already blended to work as a sum. i am using ATI graphic card. about a minute ago i tested on nvidia and then everything worked fine... so i think its a bug with ATI/AMD opengl driver... – bruchuck Aug 23 '13 at 18:08
  • @bruchuck: possible, but hard to tell without more source code. – datenwolf Aug 23 '13 at 18:14