Advertisement
Guest User

Untitled

a guest
May 20th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //////////////////////////////////
  2. ////////// Screen.vert //////////
  3. /////////////////////////////////
  4. #version 450
  5. #extension GL_ARB_separate_shader_objects : enable
  6. out gl_PerVertex {
  7.   vec4 gl_Position;
  8. };
  9.  
  10. //Big triangle covering entire screen
  11. vec2 positions[3] = vec2[](
  12.     vec2(-1.0, -1.0),
  13.     vec2(3.0, -1.0),
  14.     vec2(-1.0, 3.0)
  15. );
  16.  
  17. vec2 uvs[3] = vec2[](
  18.     vec2(0.0, 0.0),
  19.     vec2(2.0, 0.0),
  20.     vec2(0.0, 2.0)
  21. );
  22.  
  23. layout(location = 0) out vec2 fragTexCoord;
  24.  
  25. void main()
  26. {
  27.   fragTexCoord = uvs[gl_VertexIndex];
  28.   gl_Position = vec4(positions[gl_VertexIndex].x, positions[gl_VertexIndex].y, 0.0f, 1.0f);
  29. }
  30.  
  31. //////////////////////////////////
  32. ////////// Screen.frag //////////
  33. /////////////////////////////////
  34. #version 450
  35. #extension GL_ARB_separate_shader_objects : enable
  36. layout(binding = 0) uniform sampler2D _screenTexture;
  37.  
  38. layout(location = 0) in vec2 fragTexCoord;
  39. layout(location = 0) out vec4 frag_color;
  40.  
  41. void main()
  42. {
  43.     frag_color = texture(_screenTexture, fragTexCoord);
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement