vertexcolor.vp 485 B

123456789101112131415161718192021
  1. #version 140
  2. // positions are in world space
  3. in highp vec4 position;
  4. in mediump vec2 texcoord0;
  5. in mediump vec4 mycolor; // 1. Add attribute definition
  6. out mediump vec2 var_texcoord0;
  7. out mediump vec4 var_mycolor; // 2. Add output variable to pass color to fp
  8. uniform vs_uniforms
  9. {
  10. highp mat4 view_proj;
  11. };
  12. void main()
  13. {
  14. gl_Position = view_proj * vec4(position.xyz, 1.0);
  15. var_texcoord0 = texcoord0;
  16. var_mycolor = mycolor; // 3. Pass mycolor attribute value to fp.
  17. }