Started a simple font text class to do font rendering.
This commit is contained in:
parent
1830faf4c9
commit
b244c903a6
137 changed files with 16135 additions and 0 deletions
38
32-text-rendering/shaders/21-screen-kernel.frag.glsl
Normal file
38
32-text-rendering/shaders/21-screen-kernel.frag.glsl
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec2 TexCoords;
|
||||
|
||||
uniform sampler2D screenTexture;
|
||||
|
||||
const float offset = 1.0 / 300.0;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 offsets[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
|
||||
);
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
vec3 col = vec3(0.0);
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
vec3 sampleTex = vec3(texture(screenTexture, TexCoords.st + offsets[i]));
|
||||
col += sampleTex * kernel[i];
|
||||
}
|
||||
|
||||
FragColor = vec4(col, 1.0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue