vdr-plugin-softhddevice-drm-gles 1.5.9-20e15de
openglshader.h
Go to the documentation of this file.
1
22#ifndef __SOFTHDDEVICE_OPENGLSHADER_H
23#define __SOFTHDDEVICE_OPENGLSHADER_H
24
25/***********************************************************************
26 * Rectangle shaders
27 **********************************************************************/
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
43const char *rectFragmentShader =
44"#version 100 \n\
45precision mediump float; \
46varying vec4 rectCol; \
47\
48void main() \
49{ \
50 gl_FragColor = rectCol; \
51} \
52";
53
54/***********************************************************************
55 * Texture shaders
56 **********************************************************************/
58"#version 100 \n\
59\
60attribute vec2 position; \
61attribute vec2 texCoords; \
62\
63varying vec2 TexCoords; \
64varying vec4 alphaValue;\
65varying vec4 bColorValue;\
66\
67uniform vec4 bColor; \
68uniform mat4 projection; \
69uniform vec4 alpha; \
70\
71void main() \
72{ \
73 gl_Position = projection * vec4(position.x, position.y, 0.0, 1.0); \
74 TexCoords = texCoords; \
75 alphaValue = alpha; \
76 bColorValue = bColor; \
77} \
78";
79
81"#version 100 \n\
82precision mediump float; \
83varying vec2 TexCoords; \
84varying vec4 alphaValue; \
85varying vec4 bColorValue; \
86\
87uniform sampler2D screenTexture; \
88\
89float clamp_to_border_factor (vec2 coords) \
90{ \
91 bvec2 out1 = greaterThan (coords, vec2 (1,1)); \
92 bvec2 out2 = lessThan (coords, vec2 (0,0)); \
93 bool do_clamp = (any (out1) || any (out2)); \
94 return float (!do_clamp); \
95} \
96\
97void main() \
98{ \
99 vec4 color = texture2D(screenTexture, TexCoords) * alphaValue; \
100 float f = clamp_to_border_factor (TexCoords); \
101 gl_FragColor = mix (bColorValue, color, f); \
102} \
103";
104
110"#version 100 \n\
111precision mediump float; \
112varying vec2 TexCoords; \
113varying vec4 alphaValue; \
114varying vec4 bColorValue; \
115\
116uniform sampler2D screenTexture; \
117\
118float clamp_to_border_factor (vec2 coords) \
119{ \
120 bvec2 out1 = greaterThan (coords, vec2 (1,1)); \
121 bvec2 out2 = lessThan (coords, vec2 (0,0)); \
122 bool do_clamp = (any (out1) || any (out2)); \
123 return float (!do_clamp); \
124} \
125\
126void main() \
127{ \
128 vec4 color = texture2D(screenTexture, TexCoords) * alphaValue; \
129 vec4 color_swapped = vec4(color.b, color.g, color.r, color.a); \
130 float f = clamp_to_border_factor (TexCoords); \
131 gl_FragColor = mix (bColorValue, color_swapped, f); \
132} \
133";
134
135/***********************************************************************
136 * Text shaders
137 **********************************************************************/
138const char *textVertexShader =
139"#version 100 \n\
140\
141attribute vec2 position; \
142attribute vec2 texCoords; \
143\
144varying vec2 TexCoords; \
145varying vec4 textColor; \
146\
147uniform mat4 projection; \
148uniform vec4 inColor; \
149\
150void main() \
151{ \
152 gl_Position = projection * vec4(position.x, position.y, 0.0, 1.0); \
153 TexCoords = texCoords; \
154 textColor = inColor; \
155} \
156";
157
159"#version 100 \n\
160precision mediump float; \
161varying vec2 TexCoords; \
162varying vec4 textColor; \
163\
164uniform sampler2D glyphTexture; \
165\
166void main() \
167{ \
168 vec4 sampled = vec4(1.0, 1.0, 1.0, texture2D(glyphTexture, TexCoords).r); \
169 gl_FragColor = textColor * sampled; \
170} \
171";
172
173#endif
const char * textureFragmentShaderSwapBR
In difference to the textureFragmentShader this one does a blue/red color component swap.
const char * rectVertexShader
const char * textureFragmentShader
const char * rectFragmentShader
const char * textFragmentShader
const char * textureVertexShader
const char * textVertexShader