vdr-plugin-softhddevice-drm-gles 1.6.2
openglshader.h
Go to the documentation of this file.
1// SPDX-License-Identifier: AGPL-3.0-or-later
2
15#ifndef __SOFTHDDEVICE_OPENGLSHADER_H
16#define __SOFTHDDEVICE_OPENGLSHADER_H
17
28const char *rectVertexShader =
29"#version 100 \n\
30\
31attribute vec2 position; \
32varying vec4 rectCol; \
33uniform vec4 inColor; \
34uniform mat4 projection; \
35\
36void main() \
37{ \
38 gl_Position = projection * vec4(position.x, position.y, 0.0, 1.0); \
39 rectCol = inColor; \
40} \
41";
42
46const char *rectFragmentShader =
47"#version 100 \n\
48precision mediump float; \
49varying vec4 rectCol; \
50\
51void main() \
52{ \
53 gl_FragColor = rectCol; \
54} \
55";
56
61"#version 100 \n\
62\
63attribute vec2 position; \
64attribute vec2 texCoords; \
65\
66varying vec2 TexCoords; \
67varying vec4 alphaValue;\
68varying vec4 bColorValue;\
69\
70uniform vec4 bColor; \
71uniform mat4 projection; \
72uniform vec4 alpha; \
73\
74void main() \
75{ \
76 gl_Position = projection * vec4(position.x, position.y, 0.0, 1.0); \
77 TexCoords = texCoords; \
78 alphaValue = alpha; \
79 bColorValue = bColor; \
80} \
81";
82
87"#version 100 \n\
88precision mediump float; \
89varying vec2 TexCoords; \
90varying vec4 alphaValue; \
91varying vec4 bColorValue; \
92\
93uniform sampler2D screenTexture; \
94\
95float clamp_to_border_factor (vec2 coords) \
96{ \
97 bvec2 out1 = greaterThan (coords, vec2 (1,1)); \
98 bvec2 out2 = lessThan (coords, vec2 (0,0)); \
99 bool do_clamp = (any (out1) || any (out2)); \
100 return float (!do_clamp); \
101} \
102\
103void main() \
104{ \
105 vec4 color = texture2D(screenTexture, TexCoords) * alphaValue; \
106 float f = clamp_to_border_factor (TexCoords); \
107 gl_FragColor = mix (bColorValue, color, f); \
108} \
109";
110
118"#version 100 \n\
119precision mediump float; \
120varying vec2 TexCoords; \
121varying vec4 alphaValue; \
122varying vec4 bColorValue; \
123\
124uniform sampler2D screenTexture; \
125\
126float clamp_to_border_factor (vec2 coords) \
127{ \
128 bvec2 out1 = greaterThan (coords, vec2 (1,1)); \
129 bvec2 out2 = lessThan (coords, vec2 (0,0)); \
130 bool do_clamp = (any (out1) || any (out2)); \
131 return float (!do_clamp); \
132} \
133\
134void main() \
135{ \
136 vec4 color = texture2D(screenTexture, TexCoords) * alphaValue; \
137 vec4 color_swapped = vec4(color.b, color.g, color.r, color.a); \
138 float f = clamp_to_border_factor (TexCoords); \
139 gl_FragColor = mix (bColorValue, color_swapped, f); \
140} \
141";
142
146const char *textVertexShader =
147"#version 100 \n\
148\
149attribute vec2 position; \
150attribute vec2 texCoords; \
151\
152varying vec2 TexCoords; \
153varying vec4 textColor; \
154\
155uniform mat4 projection; \
156uniform vec4 inColor; \
157\
158void main() \
159{ \
160 gl_Position = projection * vec4(position.x, position.y, 0.0, 1.0); \
161 TexCoords = texCoords; \
162 textColor = inColor; \
163} \
164";
165
170"#version 100 \n\
171precision mediump float; \
172varying vec2 TexCoords; \
173varying vec4 textColor; \
174\
175uniform sampler2D glyphTexture; \
176\
177void main() \
178{ \
179 vec4 sampled = vec4(1.0, 1.0, 1.0, texture2D(glyphTexture, TexCoords).r); \
180 gl_FragColor = textColor * sampled; \
181} \
182";
183
186#endif
const char * textureFragmentShaderSwapBR
Texture Fragment Shader (swapped blue/red)
const char * rectVertexShader
Rectangle Vertex Shader.
const char * textureFragmentShader
Texture Fragment Shader.
const char * rectFragmentShader
Rectangle Fragment Shader.
const char * textFragmentShader
Text Fragment Shader.
const char * textureVertexShader
Texture Vertex Shader.
const char * textVertexShader
Text Vertex Shader.