You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
755 B

  1. #version 330
  2. // Input vertex attributes
  3. in vec3 vertexPosition;
  4. //in vec2 vertexTexCoord;
  5. in vec3 vertexNormal;
  6. in vec4 vertexColor;
  7. // Input uniform values
  8. uniform mat4 mvp;
  9. uniform mat4 matModel;
  10. uniform mat4 matNormal;
  11. // Output vertex attributes (to fragment shader)
  12. out vec3 fragPosition;
  13. //out vec2 fragTexCoord;
  14. out vec4 fragColor;
  15. out vec3 fragNormal;
  16. // NOTE: Add here your custom variables
  17. void main()
  18. {
  19. // Send vertex attributes to fragment shader
  20. fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
  21. //fragTexCoord = vertexTexCoord;
  22. fragColor = vertexColor;
  23. fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
  24. // Calculate final vertex position
  25. gl_Position = mvp*vec4(vertexPosition, 1.0);
  26. }