diff options
author | talha <talha@talhaamir.xyz> | 2024-04-28 15:48:28 +0500 |
---|---|---|
committer | talha <talha@talhaamir.xyz> | 2024-04-28 15:48:28 +0500 |
commit | ba43db84ce7e80449c505c1381b33786cc047131 (patch) | |
tree | 00df517ef5f5f86df126e32fc27e91f94ce55ac7 /source/shaders | |
parent | 708b6e523d7f57f4eb4eb8395530be9ddf67986a (diff) |
Basic text rendering is now working
Diffstat (limited to 'source/shaders')
-rw-r--r-- | source/shaders/ui_text_shader.fs.glsl | 12 | ||||
-rw-r--r-- | source/shaders/ui_text_shader.vs.glsl | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/source/shaders/ui_text_shader.fs.glsl b/source/shaders/ui_text_shader.fs.glsl new file mode 100644 index 0000000..d8bdcfb --- /dev/null +++ b/source/shaders/ui_text_shader.fs.glsl @@ -0,0 +1,12 @@ +#version 330 core + +in vec2 TexCoords; +uniform sampler2D Texture; +uniform vec3 TextColor; +out vec4 FragColor; + +void main() { + vec4 sampled = vec4(1.0, 1.0, 1.0, texture(Texture, TexCoords)); + FragColor = sampled * vec4(TextColor, 1.0); +}; + diff --git a/source/shaders/ui_text_shader.vs.glsl b/source/shaders/ui_text_shader.vs.glsl new file mode 100644 index 0000000..ecaefa4 --- /dev/null +++ b/source/shaders/ui_text_shader.vs.glsl @@ -0,0 +1,12 @@ +#version 330 core +layout(location=0) in vec3 aPos; +layout(location=1) in vec2 aTex; + +uniform mat4 Projection; + +out vec2 TexCoords; + +void main() { + gl_Position = Projection * vec4(aPos, 1.0); + TexCoords = aTex; +} |