Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. //Indexes sent
  2. { 0, 1, 3, 1, 2, 3 }
  3.  
  4. //Attribute 1 (position)
  5. {
  6. 0.0f, 0.0f, 0.0f,
  7. 0.5f, 0.0f, 0.0f,
  8. 0.5f, 0.5f, 0.0f,
  9. 0.0f, 0.5f, 0.0f
  10. }
  11.  
  12. //Attribute 2 (color)
  13. {
  14. 1.f, 0.f, 0.f,
  15. 0.f, 1.f, 0.f,
  16. 0.f, 0.f, 1.f,
  17. 1.f, 1.f, 1.f
  18. }
  19.  
  20. //Vertex Shader
  21. #version 400
  22. layout(location = 0) in vec3 vp;
  23. layout(location = 1) in vec3 incolor;
  24. flat out vec3 vert_color;
  25. void main() {
  26. gl_Position = vec4(vp, 1.0);
  27. vert_color = incolor;
  28. }
  29.  
  30. //Frag Shader
  31. #version 400
  32. flat in vec3 vert_color;
  33. out vec4 frag_color;
  34. void main() {
  35. frag_color = vec4(vert_color,1.0);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement