Small issue fix, Added post-processing fx
This commit is contained in:
parent
d8e87b4787
commit
db448390ae
@ -4,7 +4,72 @@ out vec4 FragColor;
|
|||||||
in vec2 TexCoords;
|
in vec2 TexCoords;
|
||||||
|
|
||||||
uniform sampler2D screenTexure;
|
uniform sampler2D screenTexure;
|
||||||
|
const float offset = 1.0/ 300.0;
|
||||||
|
|
||||||
void main(){
|
void main(){
|
||||||
FragColor = texture(screenTexure, TexCoords);
|
FragColor = texture(screenTexure, TexCoords);
|
||||||
|
|
||||||
|
// Inversion filter
|
||||||
|
//FragColor = vec4( vec3 (1.0 - texture(screenTexure, TexCoords) ), 1.0) ;
|
||||||
|
|
||||||
|
|
||||||
|
//grayscale
|
||||||
|
/*
|
||||||
|
FragColor = texture(screenTexure, TexCoords);
|
||||||
|
float average = (FragColor.r + FragColor.g + FragColor.b) / 3.0;
|
||||||
|
FragColor = vec4(average, average, average, 1.0);
|
||||||
|
*/
|
||||||
|
|
||||||
|
// physically accurate grayscale
|
||||||
|
// FragColor = texture(screenTexure, TexCoords);
|
||||||
|
// float average = 0.2126 * FragColor.r + 0.7152 * FragColor.g + 0.0722 * FragColor.b;
|
||||||
|
// FragColor = vec4(average,average,average, 1.0);
|
||||||
|
|
||||||
|
vec2 offset[9] = vec2[] (
|
||||||
|
vec2(-offset, offset), // top-left
|
||||||
|
vec2(0.0f, offset), // top-center
|
||||||
|
vec2(offset, offset), // top-right
|
||||||
|
vec2(-offset, 0.0f), // center-left
|
||||||
|
vec2(0.0f, 0.0f), // center-center
|
||||||
|
vec2(offset, 0.0f), // center-right
|
||||||
|
vec2(-offset, -offset), // bottom-left
|
||||||
|
vec2(0.0f, -offset), // bottom-center
|
||||||
|
vec2(offset, -offset) // bottom-right
|
||||||
|
);
|
||||||
|
|
||||||
|
// sharpen
|
||||||
|
/*float kernel[9] = float[](
|
||||||
|
-1, -1, -1,
|
||||||
|
-1, 9, -1,
|
||||||
|
-1, -1, -1
|
||||||
|
);*/
|
||||||
|
|
||||||
|
// blur
|
||||||
|
/* float kernel[9] = float[](
|
||||||
|
1.0 /16, 2.0 /16, 1.0 /16,
|
||||||
|
2.0 /16, 4.0 /16, 2.0 /16,
|
||||||
|
1.0 /16, 2.0 /16, 1.0 /16
|
||||||
|
);*/
|
||||||
|
|
||||||
|
// Edge-detection
|
||||||
|
/* float kernel[9] = float[] (
|
||||||
|
1, 1, 1,
|
||||||
|
1, -8, 1,
|
||||||
|
1, 1, 1
|
||||||
|
);
|
||||||
|
|
||||||
|
vec3 sampleTex[9];
|
||||||
|
for (int i= 0; i < 9; i++) {
|
||||||
|
sampleTex[i] = vec3(texture(screenTexure, TexCoords.st + offset[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 col = vec3(0.0);
|
||||||
|
for (int i = 0; i < 9; i++) {
|
||||||
|
col += sampleTex[i] * kernel[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
FragColor = vec4(col, 1.0);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
13
src/main.cpp
13
src/main.cpp
@ -265,16 +265,21 @@ while(!glfwWindowShouldClose(window))
|
|||||||
|
|
||||||
framebuffer.Bind();
|
framebuffer.Bind();
|
||||||
drawScene_pass(shader, backpack);
|
drawScene_pass(shader, backpack);
|
||||||
outline_pass(outlineShader, backpack);
|
//outline_pass(outlineShader, backpack);
|
||||||
|
|
||||||
// Reset stencil
|
|
||||||
|
|
||||||
|
|
||||||
|
DrawToScreen(ScreenVAO, ColourBuffer->id, framebufferShader);
|
||||||
|
|
||||||
|
// Reset stencil
|
||||||
glStencilMask(0xFF);
|
glStencilMask(0xFF);
|
||||||
glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
|
||||||
DrawToScreen(ScreenVAO, ColourBuffer->id, framebufferShader);
|
|
||||||
|
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user