Advertisement
Guest User

Untitled

a guest
Jul 4th, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. // Vertex Shader
  2.  
  3. #version 330 core
  4.  
  5. // Input vertex data, different for all executions of this shader.
  6. layout(location = 0) in vec3 vertexPosition_modelspace;
  7. layout(location = 1) in vec3 vertexColor;
  8.  
  9. // Output data ; will be interpolated for each fragment.
  10. //out vec2 UV;
  11. out vec3 fragmentColor;
  12.  
  13. // Values that stay constant for the whole mesh.
  14. uniform mat4 MVP;
  15.  
  16. void main(){
  17.  
  18.     // Output position of the vertex, in clip space : MVP * position
  19.     gl_Position =  MVP * vec4(vertexPosition_modelspace,1);
  20.    
  21.     // UV of the vertex. No special space for this one.
  22.     //UV = vertexUV;
  23.    
  24.     fragmentColor = vertexColor;
  25. }
  26.  
  27.  
  28.  
  29. // Fragment Shader
  30.  
  31. #version 330 core
  32.  
  33. // Interpolated values from the vertex shaders
  34. in vec3 fragmentColor;
  35.  
  36. // Ouput data
  37. out vec3 color;
  38.  
  39. void main()
  40. {
  41.     // Output color = color specified in the vertex shader,
  42.     // interpolated between all 3 surrounding vertices
  43.     color = fragmentColor;
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement