Hi! I’m just doing a small test with Defold and vertex colors. I saw a post somewhere (I can not find it now) that this was a feature. Maybe I’m doing something wrong, but I’m able to see it working when building the project but not in the model viewer of the editor.
Screenshot:
Vertex program:
uniform mediump mat4 view_proj;
attribute highp vec4 position;
attribute mediump vec4 color;
attribute mediump vec2 texcoord0;
varying mediump vec4 var_color;
varying mediump vec2 var_texcoord0;
void main()
{
var_color = color;
var_texcoord0 = texcoord0;
gl_Position = view_proj * vec4(position.xyz, 1.0);
}
Fragment program:
varying mediump vec4 var_color;
varying mediump vec2 var_texcoord0;
uniform lowp sampler2D tex0;
void main()
{
gl_FragColor = vec4(var_color.xyz, 1.0) * texture2D(tex0, var_texcoord0.xy);
}
If I remove the multiplied vertex color and only use the texture2D sample, I see the texture rendered correctly.
Thanks!