From 22d8faad9ab0215d32a95ad07abbc37bc6ebdd76 Mon Sep 17 00:00:00 2001 From: silas <s.developer@4-dc.de> Date: Tue, 8 Jun 2021 17:48:47 +0200 Subject: [PATCH] Fixed shaders for OpenGL ES --- AVQt/texture.fsh | 6 ++++++ AVQt/texture.vsh | 14 ++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/AVQt/texture.fsh b/AVQt/texture.fsh index e7642a4..6a1fdcd 100644 --- a/AVQt/texture.fsh +++ b/AVQt/texture.fsh @@ -1,5 +1,11 @@ // fragment shader +#ifdef GL_ES +// Set default precision to medium +precision mediump int; +precision mediump float; +#endif + in vec4 fragColor;// input: interpolated color as rgba-value in vec2 texCoord;// input: texture coordinate (xy-coordinates) out vec4 finalColor;// output: final color value as rgba-value diff --git a/AVQt/texture.vsh b/AVQt/texture.vsh index 1c47710..83caa39 100644 --- a/AVQt/texture.vsh +++ b/AVQt/texture.vsh @@ -1,12 +1,18 @@ // vertex shader -layout(location = 0) in vec3 position; // input: attribute with index '0' with 3 elements per vertex +#ifdef GL_ES +// Set default precision to medium +precision mediump int; +precision mediump float; +#endif + +layout(location = 0) in vec3 position;// input: attribute with index '0' with 3 elements per vertex //layout(location = 1) in vec3 color; // input: attribute with index '1' with 3 elements (=rgb) per vertex -layout(location = 1) in vec2 texcoords; // input: attribute with index '2' with 2 elements per vertex +layout(location = 1) in vec2 texcoords;// input: attribute with index '2' with 2 elements per vertex //layout(location = 2) in float texnr; // input: attribute with index '3' with 1 float per vertex -out vec4 fragColor; // output: computed fragmentation color -out vec2 texCoord; // output: computed texture coordinates +out vec4 fragColor;// output: computed fragmentation color +out vec2 texCoord;// output: computed texture coordinates //flat out float texID; // output: texture ID - mind the 'flat' attribute! void main() { -- GitLab