Added framebuffer to render screen to

This commit is contained in:
Dane Johnson
2021-01-19 16:01:37 -06:00
parent 22016f9d98
commit 2d4e162cd6
10 changed files with 186 additions and 7 deletions

View File

@@ -10,7 +10,9 @@ endmacro()
add_shader(flat.vert)
add_shader(flat.frag)
add_shader(screen.vert)
add_shader(screen.frag)
add_custom_target(shader_headers
DEPENDS flat.vert.h flat.frag.h
DEPENDS flat.vert.h flat.frag.h screen.vert.h screen.frag.h
COMMENT "Generated shaders headers.")

18
shaders/screen.frag Normal file
View File

@@ -0,0 +1,18 @@
#version 330 core
in vec2 UV;
out vec4 FragColor;
struct Material {
vec3 color;
bool usesColor;
sampler2D tex;
bool usesTex;
};
uniform Material material;
void main() {
FragColor = texture(material.tex, UV);
}

11
shaders/screen.vert Normal file
View File

@@ -0,0 +1,11 @@
#version 330 core
layout (location = 0) in vec3 pos;
layout (location = 1) in vec2 uv;
out vec2 UV;
void main() {
gl_Position = vec4(pos, 1.0);
UV = uv;
}