vdr-plugin-softhddevice-drm-gles 1.4.0
Macros | Functions | Variables
openglosd.cpp File Reference

Osd class - hardware accelerated (OpenGL/ES) More...

#include <algorithm>
#include "openglosd.h"
#include "glhelpers.h"
#include <inttypes.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <sys/ioctl.h>
#include "logger.h"
Include dependency graph for openglosd.cpp:

Go to the source code of this file.

Macros

#define __STL_CONFIG_H
 
#define BORDERCOLOR   0x00000000
 
#define KERNING_UNKNOWN   (-10000)
 

Functions

void ConvertColor (const GLint &colARGB, glm::vec4 &col)
 

Variables

const char * rectVertexShader
 
const char * rectFragmentShader
 
const char * textureVertexShader
 
const char * textureFragmentShader
 
const char * textureFragmentShaderSwapBR
 
const char * textVertexShader
 
const char * textFragmentShader
 
static cShaderShaders [stCount]
 
static cOglVbVertexBuffers [vbCount]
 

Detailed Description

Osd class - hardware accelerated (OpenGL/ES)

This file defines cOglOsd and all other osd classes, which create and handle the OpenGL accelerated OSD.

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

Definition in file openglosd.cpp.

Macro Definition Documentation

◆ __STL_CONFIG_H

#define __STL_CONFIG_H

Definition at line 25 of file openglosd.cpp.

◆ BORDERCOLOR

#define BORDERCOLOR   0x00000000

Definition at line 46 of file openglosd.cpp.

◆ KERNING_UNKNOWN

#define KERNING_UNKNOWN   (-10000)

Definition at line 426 of file openglosd.cpp.

Function Documentation

◆ ConvertColor()

void ConvertColor ( const GLint &  colARGB,
glm::vec4 &  col 
)

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 186 of file openglosd.cpp.

Referenced by cShader::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 171 of file openglosd.cpp.

Referenced by cShader::Load().

◆ Shaders

cShader* Shaders[stCount]
static

◆ 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 291 of file openglosd.cpp.

Referenced by cShader::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 220 of file openglosd.cpp.

Referenced by cShader::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); \
} \
"

Definition at line 245 of file openglosd.cpp.

Referenced by cShader::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 197 of file openglosd.cpp.

Referenced by cShader::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 271 of file openglosd.cpp.

Referenced by cShader::Load().

◆ VertexBuffers

cOglVb* VertexBuffers[vbCount]
static