From 269005926e6aec3abc17577eb09e0b3a3f956610 Mon Sep 17 00:00:00 2001 From: mmtalaie Date: Wed, 7 Jul 2021 17:16:35 +0430 Subject: [PATCH] First commit --- ellipse.fs | 6 ++++++ ellipse.vs | 9 +++++++++ line.fs | 7 +++++++ line.vs | 9 +++++++++ text.fs | 10 ++++++++++ text.vs | 10 ++++++++++ 6 files changed, 51 insertions(+) create mode 100644 ellipse.fs create mode 100644 ellipse.vs create mode 100644 line.fs create mode 100644 line.vs create mode 100644 text.fs create mode 100644 text.vs diff --git a/ellipse.fs b/ellipse.fs new file mode 100644 index 0000000..1ea26cd --- /dev/null +++ b/ellipse.fs @@ -0,0 +1,6 @@ +#version 330 core +in vec4 color; +out vec4 FragColor; +void main() { + FragColor = color; +} \ No newline at end of file diff --git a/ellipse.vs b/ellipse.vs new file mode 100644 index 0000000..e6ab2e9 --- /dev/null +++ b/ellipse.vs @@ -0,0 +1,9 @@ +#version 330 core +layout (location = 0) in vec4 vertices; +uniform vec4 ourColor; +out vec4 color; +void main() +{ + color = ourColor; + gl_Position = vertices; +} \ No newline at end of file diff --git a/line.fs b/line.fs new file mode 100644 index 0000000..6836b4d --- /dev/null +++ b/line.fs @@ -0,0 +1,7 @@ +#version 330 core +in vec4 color; +out vec4 FragColor; +void main() { + // FragColor = vec4(1.,1.,0., 1.0); + FragColor = color; +} \ No newline at end of file diff --git a/line.vs b/line.vs new file mode 100644 index 0000000..12934bc --- /dev/null +++ b/line.vs @@ -0,0 +1,9 @@ +#version 330 core +layout (location = 0) in vec4 vertices; +uniform vec4 ourColor; +out vec4 color; +void main() +{ + color = ourColor; + gl_Position = vertices; +} diff --git a/text.fs b/text.fs new file mode 100644 index 0000000..5d0a769 --- /dev/null +++ b/text.fs @@ -0,0 +1,10 @@ +#version 330 core +in vec2 TexCoords; +out vec4 FragColor; +uniform sampler2D text; +uniform vec3 textColor; +void main() +{ + vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, TexCoords).r); + FragColor = vec4(textColor, 1.00) * sampled; +} \ No newline at end of file diff --git a/text.vs b/text.vs new file mode 100644 index 0000000..115658e --- /dev/null +++ b/text.vs @@ -0,0 +1,10 @@ +#version 330 core +layout (location = 4) in vec4 vertex; +out vec2 TexCoords; +uniform mat4 projection; +void main() +{ + gl_Position = projection * vec4(vertex.xy, 0.0, 1.0); + TexCoords.x = vertex.z; + TexCoords.y = vertex.w; +} \ No newline at end of file