opengl es - GLSL multitexturing twoo images -


i wrote code:

"    vec3 col1 = texture2d(udiffusetexture, vec2(vtexturecoord.x, vtexturecoord.y + time)).rgb;\n" + "    float a1=1.0;\n"+   "    vec3 col2 = texture2d(unormaltexture, vec2(vtexturecoord.x + time, vtexturecoord.y)).rgb;\n" + "    float a2=ualpha;\n"+   

by way:

with: gl_fragcolor = vec4(col1+col2, a1+a2);

alpha not working...why? same, why?

my ualpha variable uniform, changes 0.1 1.0

i d draw image1 100%, , image2 0-100%

currently, you're mixing 2 images additive blending (col1+col2) without considering ualpha uniform mix 2 images.

i suppose you're trying achieve blend image2 on image1, using ualpha opacity.

vec3 col1 = texture2d(udiffusetexture, vec2(vtexturecoord.x, vtexturecoord.y + time)).rgb; vec3 col2 = texture2d(unormaltexture, vec2(vtexturecoord.x + time, vtexturecoord.y)).rgb; float a2=ualpha; vec3 result = mix(col1, col2, a2);   // combines 2 texture colors gl_fragcolor = vec4(result, 1.0); 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -