From 90fd8f8cda72d8ce985f11c0f7bc1b3bcab68a6e Mon Sep 17 00:00:00 2001 From: Michael Lutz Date: Sat, 16 Jan 2021 16:43:21 +0100 Subject: Codechange: [OpenGL] Use generic vertex attributes in the shader program. --- src/table/opengl_shader.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/table') diff --git a/src/table/opengl_shader.h b/src/table/opengl_shader.h index 43b2ca512..c59bcbcab 100644 --- a/src/table/opengl_shader.h +++ b/src/table/opengl_shader.h @@ -12,9 +12,11 @@ /** Vertex shader that just passes colour and tex coords through. */ static const char *_vertex_shader_direct[] = { "#version 110\n", + "attribute vec2 position, colour_uv;", + "varying vec2 colour_tex_uv;", "void main() {", - " gl_TexCoord[0] = gl_MultiTexCoord0;", - " gl_Position = gl_Vertex;", + " colour_tex_uv = colour_uv;", + " gl_Position = vec4(position, 0.0, 1.0);", "}", }; @@ -22,7 +24,8 @@ static const char *_vertex_shader_direct[] = { static const char *_frag_shader_direct[] = { "#version 110\n", "uniform sampler2D colour_tex;", + "varying vec2 colour_tex_uv;", "void main() {", - " gl_FragColor = texture2D(colour_tex, gl_TexCoord[0].st);", + " gl_FragColor = texture2D(colour_tex, colour_tex_uv);", "}", }; -- cgit v1.2.3-70-g09d2