Advertisement
Guest User

shaders

a guest
Mar 16th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Vertex Shader
  2.  
  3. #version 450
  4. #extension GL_ARB_separate_shader_objects : enable
  5.  
  6. layout(binding = 0) uniform UniformBufferObject
  7. {
  8.     mat4 model;
  9.     mat4 view;
  10.     mat4 proj;
  11. } ubo;
  12.  
  13. layout(location = 0) in vec2 inPosition;
  14. layout(location = 1) in vec3 inColor;
  15.  
  16. layout(location = 0) out vec3 fragColor;
  17. layout(location = 1) out vec2 fragPosition;
  18.  
  19. void main()
  20. {
  21.     gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPosition, 0.0, 1.0);
  22.     fragColor = inColor;
  23.     fragPosition = inPosition;
  24. }
  25.  
  26. // Fragment Shader
  27.  
  28. #version 450
  29. #extension GL_ARB_separate_shader_objects : enable
  30.  
  31. layout(location = 0) in vec3 fragColor;
  32. layout(location = 1) in vec2 fragPosition;
  33.  
  34. layout(location = 0) out vec4 outColor;
  35.  
  36. vec2 lightPos = {0.5, 0.7};
  37.  
  38. void main()
  39. {
  40.     //float intensity = length(inPosition - lightPos) * 0.5;
  41.     outColor = vec4(fragColor, 1.0);
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement