Vector multiplication

Hi,

I saw in some places the following code snippet in the Fragment shader.
"uniform sampler2D s_tex0;
varying vec2 v_texCoord;
varying vec4 v_primaryColor;
void main()
{
gl_FragColor = texture2D(s_tex0, v_texCoord) * v_primaryColor;
}

In the main() function, since the build-in function texture2D returns a vec4, is that legal for two vec4s to do a multiplication like that? What’s the result of vec4_foo * vec4_bar? A cross multiplication?

Thanks a lot.

-Mike

I think I found the answer. In the spec 5.9, it is said " Multiply (*) applied to two vectors yields a component-wise multiply". Thanks for reading.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.