diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-01-16 16:43:20 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-02-22 22:16:07 +0100 |
commit | acf59f6b68a3bdd068b4eddccd06749c5b411189 (patch) | |
tree | b1df72248100526f0f9ca24df283b633718ff168 /src/table | |
parent | b1818596294346a87bcb2ddb23d0b471c5c31284 (diff) | |
download | openttd-acf59f6b68a3bdd068b4eddccd06749c5b411189.tar.xz |
Codechange: [OpenGL] Use shaders to display the video buffer on screen.
Diffstat (limited to 'src/table')
-rw-r--r-- | src/table/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/table/opengl_shader.h | 28 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/table/CMakeLists.txt b/src/table/CMakeLists.txt index e63337b8a..bb2311cf1 100644 --- a/src/table/CMakeLists.txt +++ b/src/table/CMakeLists.txt @@ -85,3 +85,8 @@ add_files( unicode.h water_land.h ) + +add_files( + opengl_shader.h + CONDITION OPENGL_FOUND +) diff --git a/src/table/opengl_shader.h b/src/table/opengl_shader.h new file mode 100644 index 000000000..43b2ca512 --- /dev/null +++ b/src/table/opengl_shader.h @@ -0,0 +1,28 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. + */ + +/** @file opengl_shader.h OpenGL shader programs. */ + +/** Vertex shader that just passes colour and tex coords through. */ +static const char *_vertex_shader_direct[] = { + "#version 110\n", + "void main() {", + " gl_TexCoord[0] = gl_MultiTexCoord0;", + " gl_Position = gl_Vertex;", + "}", +}; + +/** Fragment shader that reads the fragment colour from a 32bpp texture. */ +static const char *_frag_shader_direct[] = { + "#version 110\n", + "uniform sampler2D colour_tex;", + "void main() {", + " gl_FragColor = texture2D(colour_tex, gl_TexCoord[0].st);", + "}", +}; |