vdr-plugin-softhddevice-drm-gles 1.5.9-20e15de
openglshader.h File Reference

Shader definitions for OpenGL osd class. More...

Go to the source code of this file.

Variables

const char * rectVertexShader
 
const char * rectFragmentShader
 
const char * textureVertexShader
 
const char * textureFragmentShader
 
const char * textureFragmentShaderSwapBR
 In difference to the textureFragmentShader this one does a blue/red color component swap.
 
const char * textVertexShader
 
const char * textFragmentShader
 

Detailed Description

Shader definitions for OpenGL osd class.

Note
This code was originally authored by Stefan Braun (see README), but there was never set any copyright info.

Definition in file openglshader.h.

Variable Documentation

◆ rectFragmentShader

const char* rectFragmentShader
Initial value:
=
"#version 100 \n\
precision mediump float; \
varying vec4 rectCol; \
\
void main() \
{ \
gl_FragColor = rectCol; \
} \
"

Definition at line 43 of file openglshader.h.

Referenced by cOglShader::Load().

◆ rectVertexShader

const char* rectVertexShader
Initial value:
=
"#version 100 \n\
\
attribute vec2 position; \
varying vec4 rectCol; \
uniform vec4 inColor; \
uniform mat4 projection; \
\
void main() \
{ \
gl_Position = projection * vec4(position.x, position.y, 0.0, 1.0); \
rectCol = inColor; \
} \
"

Definition at line 28 of file openglshader.h.

Referenced by cOglShader::Load().

◆ textFragmentShader

const char* textFragmentShader
Initial value:
=
"#version 100 \n\
precision mediump float; \
varying vec2 TexCoords; \
varying vec4 textColor; \
\
uniform sampler2D glyphTexture; \
\
void main() \
{ \
vec4 sampled = vec4(1.0, 1.0, 1.0, texture2D(glyphTexture, TexCoords).r); \
gl_FragColor = textColor * sampled; \
} \
"

Definition at line 158 of file openglshader.h.

Referenced by cOglShader::Load().

◆ textureFragmentShader

const char* textureFragmentShader
Initial value:
=
"#version 100 \n\
precision mediump float; \
varying vec2 TexCoords; \
varying vec4 alphaValue; \
varying vec4 bColorValue; \
\
uniform sampler2D screenTexture; \
\
float clamp_to_border_factor (vec2 coords) \
{ \
bvec2 out1 = greaterThan (coords, vec2 (1,1)); \
bvec2 out2 = lessThan (coords, vec2 (0,0)); \
bool do_clamp = (any (out1) || any (out2)); \
return float (!do_clamp); \
} \
\
void main() \
{ \
vec4 color = texture2D(screenTexture, TexCoords) * alphaValue; \
float f = clamp_to_border_factor (TexCoords); \
gl_FragColor = mix (bColorValue, color, f); \
} \
"

Definition at line 80 of file openglshader.h.

Referenced by cOglShader::Load().

◆ textureFragmentShaderSwapBR

const char* textureFragmentShaderSwapBR
Initial value:
=
"#version 100 \n\
precision mediump float; \
varying vec2 TexCoords; \
varying vec4 alphaValue; \
varying vec4 bColorValue; \
\
uniform sampler2D screenTexture; \
\
float clamp_to_border_factor (vec2 coords) \
{ \
bvec2 out1 = greaterThan (coords, vec2 (1,1)); \
bvec2 out2 = lessThan (coords, vec2 (0,0)); \
bool do_clamp = (any (out1) || any (out2)); \
return float (!do_clamp); \
} \
\
void main() \
{ \
vec4 color = texture2D(screenTexture, TexCoords) * alphaValue; \
vec4 color_swapped = vec4(color.b, color.g, color.r, color.a); \
float f = clamp_to_border_factor (TexCoords); \
gl_FragColor = mix (bColorValue, color_swapped, f); \
} \
"

In difference to the textureFragmentShader this one does a blue/red color component swap.

Definition at line 109 of file openglshader.h.

Referenced by cOglShader::Load().

◆ textureVertexShader

const char* textureVertexShader
Initial value:
=
"#version 100 \n\
\
attribute vec2 position; \
attribute vec2 texCoords; \
\
varying vec2 TexCoords; \
varying vec4 alphaValue;\
varying vec4 bColorValue;\
\
uniform vec4 bColor; \
uniform mat4 projection; \
uniform vec4 alpha; \
\
void main() \
{ \
gl_Position = projection * vec4(position.x, position.y, 0.0, 1.0); \
TexCoords = texCoords; \
alphaValue = alpha; \
bColorValue = bColor; \
} \
"

Definition at line 57 of file openglshader.h.

Referenced by cOglShader::Load().

◆ textVertexShader

const char* textVertexShader
Initial value:
=
"#version 100 \n\
\
attribute vec2 position; \
attribute vec2 texCoords; \
\
varying vec2 TexCoords; \
varying vec4 textColor; \
\
uniform mat4 projection; \
uniform vec4 inColor; \
\
void main() \
{ \
gl_Position = projection * vec4(position.x, position.y, 0.0, 1.0); \
TexCoords = texCoords; \
textColor = inColor; \
} \
"

Definition at line 138 of file openglshader.h.

Referenced by cOglShader::Load().