Now have anti-aliasing with framebuffers and can do post processing on it. Look at shaders/30-screen-bw.frag.glsl to see.
This commit is contained in:
parent
9ce217e0e2
commit
1830faf4c9
8 changed files with 67 additions and 161 deletions
13
30-anti-aliasing/shaders/30-screen-bw.frag.glsl
Normal file
13
30-anti-aliasing/shaders/30-screen-bw.frag.glsl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec2 TexCoords;
|
||||
|
||||
uniform sampler2D screenTexture;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 col = texture(screenTexture, TexCoords).rgb;
|
||||
float grayscale = 0.2126 * col.r + 0.7152 * col.g + 0.0722 * col.b;
|
||||
FragColor = vec4(vec3(grayscale), 1.0);
|
||||
}
|
||||
11
30-anti-aliasing/shaders/30-screen.frag.glsl
Normal file
11
30-anti-aliasing/shaders/30-screen.frag.glsl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec2 TexCoords;
|
||||
|
||||
uniform sampler2D screenTexture;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = texture(screenTexture, TexCoords);
|
||||
}
|
||||
11
30-anti-aliasing/shaders/30-screen.vert.glsl
Normal file
11
30-anti-aliasing/shaders/30-screen.vert.glsl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#version 330 core
|
||||
layout (location = 0) in vec2 aPos;
|
||||
layout (location = 1) in vec2 aTexCoords;
|
||||
|
||||
out vec2 TexCoords;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0);
|
||||
TexCoords = aTexCoords;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue