summaryrefslogtreecommitdiff
path: root/src/table/opengl_shader.h
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-01-16 16:43:22 +0100
committerMichael Lutz <michi@icosahedron.de>2021-02-22 22:16:07 +0100
commit821f30f7358ec3f0217b05a8d4af7101daf61678 (patch)
tree37e05e1df5237f7aad6ff93e52bdd83fd21731e1 /src/table/opengl_shader.h
parent90fd8f8cda72d8ce985f11c0f7bc1b3bcab68a6e (diff)
downloadopenttd-821f30f7358ec3f0217b05a8d4af7101daf61678.tar.xz
Codechange: [OpenGL] Use GLSL version 1.50 if available.
Diffstat (limited to 'src/table/opengl_shader.h')
-rw-r--r--src/table/opengl_shader.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/table/opengl_shader.h b/src/table/opengl_shader.h
index c59bcbcab..e3d5e0b3a 100644
--- a/src/table/opengl_shader.h
+++ b/src/table/opengl_shader.h
@@ -20,6 +20,17 @@ static const char *_vertex_shader_direct[] = {
"}",
};
+/** GLSL 1.50 vertex shader that just passes colour and tex coords through. */
+static const char *_vertex_shader_direct_150[] = {
+ "#version 150\n",
+ "in vec2 position, colour_uv;",
+ "out vec2 colour_tex_uv;",
+ "void main() {",
+ " colour_tex_uv = colour_uv;",
+ " gl_Position = vec4(position, 0.0, 1.0);",
+ "}",
+};
+
/** Fragment shader that reads the fragment colour from a 32bpp texture. */
static const char *_frag_shader_direct[] = {
"#version 110\n",
@@ -29,3 +40,14 @@ static const char *_frag_shader_direct[] = {
" gl_FragColor = texture2D(colour_tex, colour_tex_uv);",
"}",
};
+
+/** GLSL 1.50 fragment shader that reads the fragment colour from a 32bpp texture. */
+static const char *_frag_shader_direct_150[] = {
+ "#version 150\n",
+ "uniform sampler2D colour_tex;",
+ "in vec2 colour_tex_uv;",
+ "out vec4 colour;",
+ "void main() {",
+ " colour = texture(colour_tex, colour_tex_uv);",
+ "}",
+};