From ec0ab456cf869f2daa6dea41158c54da745626d8 Mon Sep 17 00:00:00 2001 From: Andy Belle-Isle Date: Wed, 18 Sep 2019 12:07:48 -0400 Subject: Added basic UI shaders --- Shaders/ui.frag | 12 ++++++++++++ Shaders/ui.vert | 14 ++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Shaders/ui.frag create mode 100644 Shaders/ui.vert (limited to 'Shaders') diff --git a/Shaders/ui.frag b/Shaders/ui.frag new file mode 100644 index 0000000..737344e --- /dev/null +++ b/Shaders/ui.frag @@ -0,0 +1,12 @@ +uniform sampler2D sampler; + +varying vec2 texCoord; +varying vec4 color; + +void main(){ + vec4 pixelColor = texture2D(sampler, vec2(texCoord.x, texCoord.y)); + //TODO allow antialiasing + //if (pixelColor.w != 1.0f) + // discard; + gl_FragColor = pixelColor * color; +} diff --git a/Shaders/ui.vert b/Shaders/ui.vert new file mode 100644 index 0000000..b2fcba4 --- /dev/null +++ b/Shaders/ui.vert @@ -0,0 +1,14 @@ +attribute vec3 coord2d; +attribute vec2 tex_coord; + +uniform mat4 ortho; +uniform vec4 tex_color; + +varying vec2 texCoord; +varying vec4 color; + +void main(){ + texCoord = tex_coord; + color = tex_color; + gl_Position = ortho * vec4(coord2d.xyz, 1.0); +} -- cgit v1.2.3