From 617fec827652d216e2d1e5015f816c4400655d73 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 21 May 2018 21:16:56 +0200 Subject: Abstract texture display buffer, shader --- src/shader/display_fragment.glsl | 11 +++++++++++ src/shader/display_vertex.glsl | 12 ++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/shader/display_fragment.glsl create mode 100644 src/shader/display_vertex.glsl (limited to 'src/shader') diff --git a/src/shader/display_fragment.glsl b/src/shader/display_fragment.glsl new file mode 100644 index 0000000..8b98ce1 --- /dev/null +++ b/src/shader/display_fragment.glsl @@ -0,0 +1,11 @@ +static const std::string DISPLAY_FRAGMENT_SHADER_CODE = R"( +#version 330 core + +out vec4 FragColor; +in vec2 TexCoords; +uniform sampler2D screen_texture; + +void main() { + FragColor = texture(screen_texture, TexCoords); +} +)"; diff --git a/src/shader/display_vertex.glsl b/src/shader/display_vertex.glsl new file mode 100644 index 0000000..60bbfc7 --- /dev/null +++ b/src/shader/display_vertex.glsl @@ -0,0 +1,12 @@ +static const std::string DISPLAY_VERTEX_SHADER_CODE = R"( +#version 330 core + +layout (location = 0) in vec2 screen_vertex; +layout (location = 1) in vec2 texture_vertex; +out vec2 TexCoords; + +void main() { + gl_Position = vec4(screen_vertex, 0.0, 1.0); + TexCoords = texture_vertex; +} +)"; -- cgit v1.2.3