vertexcolor.vp 614 B

1234567891011121314151617181920212223242526272829
  1. #version 140
  2. // Models vertex color attribute comes in as rgba floats (vec4)
  3. in vec4 color;
  4. // The model's vertex position.
  5. in vec4 position;
  6. // The model's world matrix.
  7. in mat4 mtx_world;
  8. // The projection and view matrices.
  9. uniform general_vp
  10. {
  11. mat4 mtx_view;
  12. mat4 mtx_proj;
  13. };
  14. // The output of a vertex shader are passed to the fragment shader.
  15. out vec4 vertex_color;
  16. void main()
  17. {
  18. // Setting the vertex colors to the passed varying.
  19. vertex_color = color;
  20. // Transform the vertex position to clip space.
  21. gl_Position = mtx_proj * mtx_view * mtx_world * vec4(position.xyz, 1.0);
  22. }