vdr-plugin-softhddevice-drm-gles 1.6.4-d0291bb
openglosd.h
Go to the documentation of this file.
1// SPDX-License-Identifier: AGPL-3.0-or-later
2
15#ifndef __SOFTHDDEVICE_OPENGLOSD_H
16#define __SOFTHDDEVICE_OPENGLOSD_H
17
18#include <cstdio>
19#include <memory>
20#include <mutex>
21#include <queue>
22
23#include <ft2build.h>
24#include FT_FREETYPE_H
25#include FT_LCD_FILTER_H
26#include FT_STROKER_H
27
28#undef __FTERRORS_H__
29#define FT_ERRORDEF( e, v, s ) { e, s },
30#define FT_ERROR_START_LIST {
31#define FT_ERROR_END_LIST { 0, 0 } };
32const struct {
33 int code;
34 const char* message;
35} FT_Errors[] =
36#include FT_ERRORS_H
37
38#include <GLES2/gl2.h>
39#include <glm/glm.hpp>
40#include <glm/gtc/matrix_transform.hpp>
41
42#include <vdr/osd.h>
43
45class cVideoRender;
46
53#define BORDERCOLOR 0x00000000
54
61
69
78public:
79 cOglShader(void) {};
80
81 bool Load(eShaderType);
82 void Use(void);
83 void SetFloat (const GLchar *, GLfloat);
84 void SetInteger (const GLchar *, GLint);
85 void SetVector2f (const GLchar *, GLfloat, GLfloat);
86 void SetVector3f (const GLchar *, GLfloat, GLfloat, GLfloat);
88 void SetMatrix4 (const GLchar *, const glm::mat4 &);
89
90private:
93
94 bool Compile(const char *, const char *);
95 bool CheckCompileErrors(GLuint, bool program = false);
96};
97
103class cOglGlyph : public cListObject {
104public:
106 virtual ~cOglGlyph();
107
108 FT_ULong CharCode(void) { return m_charCode; }
109 int AdvanceX(void) { return m_advanceX; }
110 int BearingLeft(void) const { return m_bearingLeft; }
111 int BearingTop(void) const { return m_bearingTop; }
112 int Width(void) const { return m_width; }
113 int Height(void) const { return m_height; }
115 void SetKerningCache(FT_ULong, int);
116 void LoadTexture(void);
117 void BindTexture(void);
118protected:
119 struct tKerning {
120 public:
122 this->prevSym = prevSym;
123 this->kerning = kerning;
124 }
127 };
133 unsigned char *m_pBuffer;
137};
138
146class cOglAtlasGlyph : public cOglGlyph {
147public:
153
154 int AdvanceY(void) { return m_advanceY; }
155 float OffsetX(void) const { return m_offsetX; }
156 float OffsetY(void) const { return m_offsetY; }
157private:
161};
162
163#define MIN_CHARCODE 32
164#define MAX_CHARCODE 255
165
181public:
183 virtual ~cOglFontAtlas(void);
184 cOglAtlasGlyph* GetGlyph(int) const;
185 int Height(void) const { return m_height; }
186 int Width(void) const { return m_width; }
187 void BindTexture(void);
188private:
190 int m_width = 0;
191 int m_height = 0;
193};
194
202class cOglFont : public cListObject {
203public:
204 virtual ~cOglFont(void);
205 static cOglFont *Get(const char *, int);
206 cOglFontAtlas *Atlas(void) { return m_pAtlas; };
207 static void Cleanup(void);
208 const char *Name(void) { return *m_name; };
209 int Size(void) { return m_size; };
210 int Bottom(void) {return m_bottom; };
211 int Height(void) {return m_height; };
212 cOglGlyph* Glyph(FT_ULong) const;
213 int Kerning(cOglGlyph *glyph, FT_ULong prevSym) const;
214private:
215 static bool s_initiated;
218
221 int m_height = 0;
222 int m_bottom = 0;
226
227 cOglFont(const char *, int);
228 static void Init(void);
229};
230
238class cOglFb {
239public:
241 virtual ~cOglFb(void);
242
243 bool Initiated(void) { return m_initiated; }
244 virtual bool Init(void);
245 void Bind(void);
246 virtual void Unbind(void);
247 bool BindTexture(void);
249 GLint Width(void) { return m_width; };
250 GLint Height(void) { return m_height; };
251 bool Scrollable(void) { return m_scrollable; };
254protected:
255 bool m_initiated = false;
257private:
261 bool m_scrollable = false;
262};
263
271class cOglOutputFb : public cOglFb {
272public:
273 cOglOutputFb(GLint width, GLint height) : cOglFb(width, height, width, height) {};
274
275 virtual bool Init(void);
276 virtual void Unbind(void);
277private:
280};
281
291
299class cOglVb {
300public:
301 cOglVb(int type) : m_type((eVertexBufferType)type) {};
302 virtual ~cOglVb(void) {};
303
304 bool Init(void);
305 void Bind(void);
306 void Unbind(void);
307 void ActivateShader(void);
308 void EnableBlending(void);
309 void DisableBlending(void);
310 void SetShaderColor(GLint);
313 void SetShaderAlpha(GLint);
315 void SetVertexSubData(GLfloat *, int count = 0);
316 void SetVertexData(GLfloat *, int count = 0);
317 void DrawArrays(int count = 0);
318private:
329};
330
339class cOglCmd {
340public:
343 virtual ~cOglCmd(void) {};
344 virtual const char* Description(void) = 0;
345 virtual bool Execute(void) = 0;
346 virtual bool NeedsLockingAgainstStateChange(void) { return false; };
347protected:
349};
350
357public:
361 virtual ~cOglCmdInitOutputFb(void) {};
362 virtual const char* Description(void) { return "InitOutputFramebuffer"; }
363 virtual bool Execute(void);
364private:
366};
367
373class cOglCmdInitFb : public cOglCmd {
374public:
378 virtual ~cOglCmdInitFb(void) {};
379 virtual const char* Description(void) { return "InitFramebuffer"; }
380 virtual bool Execute(void);
381private:
383};
384
390class cOglCmdDeleteFb : public cOglCmd {
391public:
394 virtual ~cOglCmdDeleteFb(void) {};
395 virtual const char* Description(void) { return "DeleteFramebuffer"; }
396 virtual bool Execute(void);
397};
398
435
442public:
444 : cOglCmd(fb),
446 m_x((GLfloat)x),
447 m_y((GLfloat)y),
449 m_active(active),
450 m_pDevice(device) {};
452 virtual const char* Description(void) { return "Copy buffer to OutputFramebuffer"; }
453 virtual bool Execute(void);
454 bool NeedsLockingAgainstStateChange(void) { return true; };
455private:
461};
462
468class cOglCmdFill : public cOglCmd {
469public:
473 virtual ~cOglCmdFill(void) {};
474 virtual const char* Description(void) { return "Fill"; }
475 virtual bool Execute(void);
476private:
478};
479
486public:
490 virtual ~cOglCmdBufferFill(void) {};
491 virtual const char* Description(void) { return "Fill Buffer "; }
492 virtual bool Execute(void);
493private:
495};
496
503public:
505 : cOglCmd(fb),
506 m_x(x),
507 m_y(y),
508 m_width(width),
509 m_height(height),
510 m_color(color) {};
511 virtual ~cOglCmdDrawRectangle(void) {};
512 virtual const char* Description(void) { return "DrawRectangle"; }
513 virtual bool Execute(void);
514private:
518};
519
526public:
528 : cOglCmd(fb),
529 m_x(x),
530 m_y(y),
531 m_width(width),
532 m_height(height),
533 m_color(color),
535 virtual ~cOglCmdDrawEllipse(void) {};
536 virtual const char* Description(void) { return "DrawEllipse "; }
537 virtual bool Execute(void);
538private:
543
547};
548
554class cOglCmdDrawSlope : public cOglCmd {
555public:
557 : cOglCmd(fb),
558 m_x(x),
559 m_y(y),
560 m_width(width),
561 m_height(height),
562 m_color(color),
563 m_type(type) {};
564 virtual ~cOglCmdDrawSlope(void) {};
565 virtual const char* Description(void) { return "DrawSlope "; }
566 virtual bool Execute(void);
567private:
572};
573
579class cOglCmdDrawText : public cOglCmd {
580public:
581 cOglCmdDrawText(cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name, int fontSize, tColor colorText, int length)
582 : cOglCmd(fb),
583 m_x(x),
584 m_y(y),
588 m_fontName(name),
591 virtual ~cOglCmdDrawText(void) { free(m_pSymbols); };
592 virtual const char* Description(void) { return "DrawText "; }
593 virtual bool Execute(void);
594private:
601 unsigned int *m_pSymbols;
602};
603
609class cOglCmdDrawImage : public cOglCmd {
610public:
611 cOglCmdDrawImage(cOglFb *fb, tColor *argb, GLint width, GLint height, GLint x, GLint y, bool overlay = true, double scaleX = 1.0f, double scaleY = 1.0f)
612 : cOglCmd(fb),
613 m_argb(argb),
614 m_x(x),
615 m_y(y),
616 m_width(width),
617 m_height(height),
622 virtual ~cOglCmdDrawImage(void) { free(m_argb); };
623 virtual const char* Description(void) { return "Draw Image"; }
624 virtual bool Execute(void);
625private:
631};
632
639public:
640 cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y, double scaleX = 1.0f, double scaleY = 1.0f)
641 : cOglCmd(fb),
643 m_x(x),
644 m_y(y),
648 virtual ~cOglCmdDrawTexture(void) {};
649 virtual const char* Description(void) { return "Draw Texture"; }
650 virtual bool Execute(void);
651private:
656};
657
664public:
669 virtual ~cOglCmdStoreImage(void) { free(m_pData); };
670 virtual const char* Description(void) { return "Store Image"; }
671 virtual bool Execute(void);
672private:
675};
676
682class cOglCmdDropImage : public cOglCmd {
683public:
688 virtual ~cOglCmdDropImage(void) {};
689 virtual const char* Description(void) { return "Drop Image"; }
690 virtual bool Execute(void);
691private:
694};
695
696#define OGL_MAX_OSDIMAGES 512
697#define OGL_CMDQUEUE_SIZE 200
698
713class cOglThread : public cThread {
714public:
716 virtual ~cOglThread(void) {};
717
718 void RequestStop(void);
719 void Stop(void);
720 void DoCmd(cOglCmd*);
721 int StoreImage(const cImage &);
722 void DropImageData(int);
724 int MaxTextureSize(void) { return m_maxTextureSize; };
725 void LockOutputFb(void) { m_mutex.lock(); };
726 void UnlockOutputFb(void) { m_mutex.unlock(); };
727protected:
728 virtual void Action(void);
729private:
732 bool m_stalled = false;
733 std::queue<cOglCmd*> m_commands;
736 long m_memCached = 0;
739 std::mutex m_mutex;
740
741 bool InitOpenGL(void);
742 bool InitShaders(void);
743 void DeleteShaders(void);
744 bool InitVertexBuffers(void);
745 void DeleteVertexBuffers(void);
746 void Cleanup(void);
747 void CleanupImageCache(void);
748 int GetFreeSlot(void);
749 void ClearSlot(int slot);
750 void eglAcquireContext(void);
751};
752
758class cOglPixmap : public cPixmap {
759public:
760 cOglPixmap(std::shared_ptr<cOglThread>, int, const cRect &, const cRect &DrawPort = cRect::Null);
761 virtual ~cOglPixmap(void);
762
764 int X(void) { return ViewPort().X(); };
765 int Y(void) { return ViewPort().Y(); };
766 virtual bool IsDirty(void) { return m_dirty; }
767 virtual void SetDirty(bool dirty = true) { m_dirty = dirty; }
768 virtual void SetLayer(int);
769 virtual void SetAlpha(int);
770 virtual void SetTile(bool);
771 virtual void SetViewPort(const cRect &);
772 virtual void SetDrawPortPoint(const cPoint &, bool Dirty = true);
773 virtual void Clear(void);
774 virtual void Fill(tColor);
775 virtual void DrawImage(const cPoint &, const cImage &);
776 virtual void DrawImage(const cPoint &, int);
777 virtual void DrawScaledImage(const cPoint &, const cImage &, double FactorX = 1.0f, double FactorY = 1.0f, bool AntiAlias = false);
778 virtual void DrawScaledImage(const cPoint &, int, double FactorX = 1.0f, double FactorY = 1.0f, bool AntiAlias = false);
779 virtual void DrawPixel(const cPoint &, tColor);
780 virtual void DrawBitmap(const cPoint &, const cBitmap &, tColor ColorFg = 0, tColor ColorBg = 0, bool Overlay = false);
781 virtual void DrawText(const cPoint &, const char *, tColor, tColor, const cFont *, int Width = 0, int Height = 0, int Alignment = taDefault);
782 virtual void DrawRectangle(const cRect &, tColor);
783 virtual void DrawEllipse(const cRect &, tColor, int Quadrants = 0);
784 virtual void DrawSlope(const cRect &, tColor, int);
785 virtual void Render(const cPixmap *, const cRect &, const cPoint &);
786 virtual void Copy(const cPixmap *, const cRect &, const cPoint &);
787 virtual void Scroll(const cPoint &, const cRect &Source = cRect::Null);
788 virtual void Pan(const cPoint &, const cRect &Source = cRect::Null);
789 virtual void MarkViewPortDirty(const cRect &);
790 virtual void SetClean(void);
791private:
793 std::shared_ptr<cOglThread> m_pOglThread;
794 bool m_dirty = true;
795#ifdef GRIDPOINTS
797
798 void DrawGridRect(const cRect &, int, int, tColor, tColor, const cFont *);
799 void DrawGridText(const cPoint &, const char *, tColor, tColor, const cFont *, int Width = 0, int Height = 0, int Alignment = taDefault);
800#endif
801 void DrawTextInternal(const cPoint &, const char *, tColor, tColor, const cFont *, int Width = 0, int Height = 0, int Alignment = taDefault, bool isGridText = false);
802};
803
809class cOglOsd : public cOsd {
810public:
811 cOglOsd(int, int, uint, std::shared_ptr<cOglThread>, cSoftHdDevice *);
812 virtual ~cOglOsd();
813
814 virtual eOsdError SetAreas(const tArea *, int);
815 virtual cPixmap *CreatePixmap(int, const cRect &, const cRect &DrawPort = cRect::Null);
816 virtual void DestroyPixmap(cPixmap *);
817 virtual void Flush(void);
818 virtual const cSize &MaxPixmapSize(void) const { return m_maxPixmapSize; };
819 virtual void DrawScaledBitmap(int, int, const cBitmap &, double, double, bool AntiAlias = false);
820
822private:
825 std::shared_ptr<cOglThread> m_pOglThread;
831};
832
833#endif
OpenGL OSD Glyph on a Texture Atlas.
Definition openglosd.h:146
float OffsetY(void) const
Definition openglosd.h:156
int AdvanceY(void)
Definition openglosd.h:154
float OffsetX(void) const
Definition openglosd.h:155
cOglAtlasGlyph(FT_ULong charCode, FT_BitmapGlyph ftGlyph, float offsetX, float offsetY)
Definition openglosd.h:148
OpenGL command: Fill a framebuffer.
Definition openglosd.h:485
virtual ~cOglCmdBufferFill(void)
Definition openglosd.h:490
cOglCmdBufferFill(cOglFb *fb, GLint color)
Definition openglosd.h:487
virtual const char * Description(void)
Definition openglosd.h:491
virtual bool Execute(void)
OpenGL command: Render a framebuffer to the output framebuffer.
Definition openglosd.h:441
virtual const char * Description(void)
Definition openglosd.h:452
cOglOutputFb * m_pOutputFramebuffer
Definition openglosd.h:456
virtual ~cOglCmdCopyBufferToOutputFb(void)
Definition openglosd.h:451
bool NeedsLockingAgainstStateChange(void)
Definition openglosd.h:454
virtual bool Execute(void)
cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputFb *oFb, GLint x, GLint y, int active, cSoftHdDevice *device)
Definition openglosd.h:443
cSoftHdDevice * m_pDevice
Definition openglosd.h:460
OpenGL command: Delete a framebuffer.
Definition openglosd.h:390
virtual ~cOglCmdDeleteFb(void)
Definition openglosd.h:394
virtual bool Execute(void)
virtual const char * Description(void)
Definition openglosd.h:395
cOglCmdDeleteFb(cOglFb *fb)
Definition openglosd.h:392
OpenGL command: Draw an ellipse.
Definition openglosd.h:525
virtual ~cOglCmdDrawEllipse(void)
Definition openglosd.h:535
GLfloat * CreateVerticesFull(int &)
GLfloat * CreateVerticesHalf(int &)
GLfloat * CreateVerticesQuadrant(int &)
virtual const char * Description(void)
Definition openglosd.h:536
virtual bool Execute(void)
cOglCmdDrawEllipse(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint quadrants)
Definition openglosd.h:527
OpenGL command: Draw an image.
Definition openglosd.h:609
virtual bool Execute(void)
virtual ~cOglCmdDrawImage(void)
Definition openglosd.h:622
virtual const char * Description(void)
Definition openglosd.h:623
cOglCmdDrawImage(cOglFb *fb, tColor *argb, GLint width, GLint height, GLint x, GLint y, bool overlay=true, double scaleX=1.0f, double scaleY=1.0f)
Definition openglosd.h:611
tColor * m_argb
Definition openglosd.h:626
OpenGL command: Draw a rectangle.
Definition openglosd.h:502
virtual bool Execute(void)
cOglCmdDrawRectangle(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color)
Definition openglosd.h:504
virtual ~cOglCmdDrawRectangle(void)
Definition openglosd.h:511
virtual const char * Description(void)
Definition openglosd.h:512
OpenGL command: Draw a slope.
Definition openglosd.h:554
virtual bool Execute(void)
virtual const char * Description(void)
Definition openglosd.h:565
virtual ~cOglCmdDrawSlope(void)
Definition openglosd.h:564
cOglCmdDrawSlope(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint type)
Definition openglosd.h:556
OpenGL command: Draw a text.
Definition openglosd.h:579
cOglCmdDrawText(cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name, int fontSize, tColor colorText, int length)
Definition openglosd.h:581
cString m_fontName
Definition openglosd.h:599
unsigned int * m_pSymbols
Definition openglosd.h:601
virtual bool Execute(void)
virtual ~cOglCmdDrawText(void)
Definition openglosd.h:591
virtual const char * Description(void)
Definition openglosd.h:592
OpenGL command: Draw a texture.
Definition openglosd.h:638
virtual const char * Description(void)
Definition openglosd.h:649
virtual bool Execute(void)
virtual ~cOglCmdDrawTexture(void)
Definition openglosd.h:648
sOglImage * m_pImageRef
Definition openglosd.h:652
cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y, double scaleX=1.0f, double scaleY=1.0f)
Definition openglosd.h:640
OpenGL command: Drop image from cache.
Definition openglosd.h:682
virtual ~cOglCmdDropImage(void)
Definition openglosd.h:688
cOglCmdDropImage(sOglImage *imageRef, cCondWait *wait)
Definition openglosd.h:684
virtual const char * Description(void)
Definition openglosd.h:689
sOglImage * m_pImageRef
Definition openglosd.h:692
cCondWait * m_pWait
Definition openglosd.h:693
virtual bool Execute(void)
OpenGL command: Fill a polygon.
Definition openglosd.h:468
virtual const char * Description(void)
Definition openglosd.h:474
cOglCmdFill(cOglFb *fb, GLint color)
Definition openglosd.h:470
GLint m_color
Definition openglosd.h:477
virtual ~cOglCmdFill(void)
Definition openglosd.h:473
virtual bool Execute(void)
OpenGL command: Init a framebuffer.
Definition openglosd.h:373
virtual ~cOglCmdInitFb(void)
Definition openglosd.h:378
virtual bool Execute(void)
cOglCmdInitFb(cOglFb *fb, cCondWait *wait=NULL)
Definition openglosd.h:375
virtual const char * Description(void)
Definition openglosd.h:379
cCondWait * m_wait
Definition openglosd.h:382
OpenGL command: Init the output framebuffer.
Definition openglosd.h:356
virtual const char * Description(void)
Definition openglosd.h:362
cOglCmdInitOutputFb(cOglOutputFb *oFb)
Definition openglosd.h:358
cOglOutputFb * m_pOutputFramebuffer
Definition openglosd.h:365
virtual ~cOglCmdInitOutputFb(void)
Definition openglosd.h:361
virtual bool Execute(void)
OpenGL command: Render a framebuffer to another framebuffer.
Definition openglosd.h:404
virtual bool Execute(void)
virtual ~cOglCmdRenderFbToBufferFb(void)
Definition openglosd.h:420
virtual const char * Description(void)
Definition openglosd.h:421
cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency, GLint drawPortX, GLint drawPortY, GLint dirtyX, GLint dirtyTop, GLint dirtyWidth, GLint dirtyHeight, bool alphablending)
Definition openglosd.h:406
OpenGL command: Store image in the cache.
Definition openglosd.h:663
sOglImage * m_pImageRef
Definition openglosd.h:673
virtual bool Execute(void)
cOglCmdStoreImage(sOglImage *imageRef, tColor *argb)
Definition openglosd.h:665
virtual ~cOglCmdStoreImage(void)
Definition openglosd.h:669
virtual const char * Description(void)
Definition openglosd.h:670
OpenGL Hardware Command.
Definition openglosd.h:339
cOglFb * m_pFramebuffer
Definition openglosd.h:348
virtual bool NeedsLockingAgainstStateChange(void)
Definition openglosd.h:346
virtual bool Execute(void)=0
virtual ~cOglCmd(void)
Definition openglosd.h:343
virtual const char * Description(void)=0
cOglCmd(cOglFb *fb)
Definition openglosd.h:341
OpenGL OSD Framebuffer/ Texture Object.
Definition openglosd.h:238
GLint m_width
Definition openglosd.h:256
GLuint m_framebuffer
Definition openglosd.h:258
virtual void Unbind(void)
GLint ViewportHeight(void)
Definition openglosd.h:253
GLuint m_texture
Definition openglosd.h:259
void Bind(void)
GLint m_viewPortWidth
Definition openglosd.h:260
GLint Height(void)
Definition openglosd.h:250
void Blit(GLint, GLint, GLint, GLint)
virtual ~cOglFb(void)
GLint ViewportWidth(void)
Definition openglosd.h:252
GLint Width(void)
Definition openglosd.h:249
bool m_scrollable
Definition openglosd.h:261
bool Scrollable(void)
Definition openglosd.h:251
bool Initiated(void)
Definition openglosd.h:243
GLint m_height
Definition openglosd.h:256
bool BindTexture(void)
GLint m_viewPortHeight
Definition openglosd.h:260
virtual bool Init(void)
bool m_initiated
Definition openglosd.h:255
OpenGL OSD Texture Atlas for a Font.
Definition openglosd.h:180
GLuint m_texture
Definition openglosd.h:189
int Width(void) const
Definition openglosd.h:186
cOglAtlasGlyph * GetGlyph(int) const
virtual ~cOglFontAtlas(void)
int Height(void) const
Definition openglosd.h:185
void BindTexture(void)
cOglAtlasGlyph * m_pGlyph[MAX_CHARCODE - MIN_CHARCODE+1]
Definition openglosd.h:192
OpenGL OSD Representation of a VDR Font.
Definition openglosd.h:202
int Height(void)
Definition openglosd.h:211
int m_size
Definition openglosd.h:220
cString m_name
Definition openglosd.h:219
static void Cleanup(void)
cOglFontAtlas * Atlas(void)
Definition openglosd.h:206
cOglGlyph * Glyph(FT_ULong) const
int Bottom(void)
Definition openglosd.h:210
static void Init(void)
static cOglFont * Get(const char *, int)
virtual ~cOglFont(void)
FT_Face m_face
Definition openglosd.h:223
int Size(void)
Definition openglosd.h:209
cOglFontAtlas * m_pAtlas
Definition openglosd.h:225
int Kerning(cOglGlyph *glyph, FT_ULong prevSym) const
cList< cOglGlyph > m_glyphCache
Definition openglosd.h:224
int m_bottom
Definition openglosd.h:222
int m_height
Definition openglosd.h:221
static bool s_initiated
Definition openglosd.h:215
static FT_Library s_ftLib
Definition openglosd.h:216
const char * Name(void)
Definition openglosd.h:208
static cList< cOglFont > * s_pFonts
Definition openglosd.h:217
OpenGL OSD Glyph of a Font.
Definition openglosd.h:103
int AdvanceX(void)
Definition openglosd.h:109
void BindTexture(void)
int m_advanceX
Definition openglosd.h:134
GLuint m_texture
Definition openglosd.h:136
FT_ULong m_charCode
Definition openglosd.h:128
void LoadTexture(void)
unsigned char * m_pBuffer
Definition openglosd.h:133
int BearingTop(void) const
Definition openglosd.h:111
void SetKerningCache(FT_ULong, int)
int Height(void) const
Definition openglosd.h:113
virtual ~cOglGlyph()
int m_bearingTop
Definition openglosd.h:130
int BearingLeft(void) const
Definition openglosd.h:110
int Width(void) const
Definition openglosd.h:112
FT_ULong CharCode(void)
Definition openglosd.h:108
int GetKerningCache(FT_ULong)
int m_height
Definition openglosd.h:132
int m_bearingLeft
Definition openglosd.h:129
cVector< tKerning > m_pKerningCache
Definition openglosd.h:135
int m_width
Definition openglosd.h:131
OpenGL OSD Implementation (GPU accelerated)
Definition openglosd.h:809
virtual ~cOglOsd()
std::shared_ptr< cOglThread > m_pOglThread
pointer to thread, which executes the commands
Definition openglosd.h:825
bool m_isSubtitleOsd
true, if this is a subtitle osd
Definition openglosd.h:827
cSoftHdDevice * m_pDevice
pointer to cSofthdDevice
Definition openglosd.h:830
cOglFb * m_pBufferFramebuffer
all pixmaps are composed onto this framebuffer after each other, before this one is blit onto the OSD...
Definition openglosd.h:823
static cOglOutputFb * OutputFramebuffer
main OSD output framebuffer - this keeps our finished "OSD" (one per OSD)
Definition openglosd.h:821
virtual void Flush(void)
virtual eOsdError SetAreas(const tArea *, int)
cRect m_pDirtyViewport
the dirty viewport
Definition openglosd.h:829
virtual void DrawScaledBitmap(int, int, const cBitmap &, double, double, bool AntiAlias=false)
virtual const cSize & MaxPixmapSize(void) const
Definition openglosd.h:818
virtual cPixmap * CreatePixmap(int, const cRect &, const cRect &DrawPort=cRect::Null)
cVector< cOglPixmap * > m_pOglPixmaps
array of pixmaps
Definition openglosd.h:826
cSize m_maxPixmapSize
maximum allowed size of a pixmap (depends on the maximum OpenGL texture size)
Definition openglosd.h:828
virtual void DestroyPixmap(cPixmap *)
Main Framebuffer/ Texture Object for OSD.
Definition openglosd.h:271
GLuint m_framebuffer
Definition openglosd.h:278
virtual void Unbind(void)
GLuint m_texture
Definition openglosd.h:279
virtual bool Init(void)
cOglOutputFb(GLint width, GLint height)
Definition openglosd.h:273
OpenGL Implementation of a cPixmap.
Definition openglosd.h:758
virtual void Clear(void)
virtual void SetClean(void)
virtual void DrawRectangle(const cRect &, tColor)
virtual void Pan(const cPoint &, const cRect &Source=cRect::Null)
int X(void)
Definition openglosd.h:764
virtual bool IsDirty(void)
Definition openglosd.h:766
virtual void DrawPixel(const cPoint &, tColor)
void DrawTextInternal(const cPoint &, const char *, tColor, tColor, const cFont *, int Width=0, int Height=0, int Alignment=taDefault, bool isGridText=false)
virtual void DrawImage(const cPoint &, const cImage &)
virtual ~cOglPixmap(void)
virtual void DrawSlope(const cRect &, tColor, int)
virtual void DrawText(const cPoint &, const char *, tColor, tColor, const cFont *, int Width=0, int Height=0, int Alignment=taDefault)
cOglFb * m_pFramebuffer
everything is drawn onto this framebuffer (one per pixmap)
Definition openglosd.h:792
std::shared_ptr< cOglThread > m_pOglThread
Definition openglosd.h:793
int Y(void)
Definition openglosd.h:765
cOglFb * Framebuffer(void)
Definition openglosd.h:763
virtual void SetTile(bool)
virtual void SetDirty(bool dirty=true)
Definition openglosd.h:767
virtual void MarkViewPortDirty(const cRect &)
virtual void Scroll(const cPoint &, const cRect &Source=cRect::Null)
virtual void SetLayer(int)
virtual void DrawScaledImage(const cPoint &, int, double FactorX=1.0f, double FactorY=1.0f, bool AntiAlias=false)
virtual void Fill(tColor)
virtual void SetDrawPortPoint(const cPoint &, bool Dirty=true)
virtual void DrawBitmap(const cPoint &, const cBitmap &, tColor ColorFg=0, tColor ColorBg=0, bool Overlay=false)
bool m_dirty
true, if there was draw activity on the pixmap
Definition openglosd.h:794
virtual void Render(const cPixmap *, const cRect &, const cPoint &)
virtual void Copy(const cPixmap *, const cRect &, const cPoint &)
virtual void DrawEllipse(const cRect &, tColor, int Quadrants=0)
virtual void SetAlpha(int)
virtual void DrawScaledImage(const cPoint &, const cImage &, double FactorX=1.0f, double FactorY=1.0f, bool AntiAlias=false)
virtual void SetViewPort(const cRect &)
OpenGL OSD Vertex/Fragment Shader.
Definition openglosd.h:77
bool CheckCompileErrors(GLuint, bool program=false)
void SetMatrix4(const GLchar *, const glm::mat4 &)
void SetVector4f(const GLchar *, GLfloat, GLfloat, GLfloat, GLfloat)
void Use(void)
Definition openglosd.cpp:87
void SetFloat(const GLchar *, GLfloat)
void SetInteger(const GLchar *, GLint)
cOglShader(void)
Definition openglosd.h:79
GLuint m_id
Definition openglosd.h:92
void SetVector3f(const GLchar *, GLfloat, GLfloat, GLfloat)
bool Load(eShaderType)
Definition openglosd.cpp:92
eShaderType m_type
Definition openglosd.h:91
bool Compile(const char *, const char *)
void SetVector2f(const GLchar *, GLfloat, GLfloat)
OpenGL Commands Processing Thread.
Definition openglosd.h:713
long m_memCached
Definition openglosd.h:736
void DoCmd(cOglCmd *)
long m_maxCacheSize
Definition openglosd.h:737
bool InitOpenGL(void)
bool InitVertexBuffers(void)
bool m_stalled
Definition openglosd.h:732
void CleanupImageCache(void)
sOglImage m_imageCache[OGL_MAX_OSDIMAGES]
Definition openglosd.h:735
int GetFreeSlot(void)
void Stop(void)
bool InitShaders(void)
void UnlockOutputFb(void)
Definition openglosd.h:726
void LockOutputFb(void)
Definition openglosd.h:725
virtual ~cOglThread(void)
Definition openglosd.h:716
cCondWait * m_startWait
Definition openglosd.h:730
cCondWait m_wait
Definition openglosd.h:731
void DropImageData(int)
void Cleanup(void)
void DeleteShaders(void)
virtual void Action(void)
void ClearSlot(int slot)
void RequestStop(void)
int StoreImage(const cImage &)
cVideoRender * m_pRender
Definition openglosd.h:738
int MaxTextureSize(void)
Definition openglosd.h:724
sOglImage * GetImageRef(int)
std::mutex m_mutex
Definition openglosd.h:739
GLint m_maxTextureSize
Definition openglosd.h:734
void DeleteVertexBuffers(void)
std::queue< cOglCmd * > m_commands
Definition openglosd.h:733
void eglAcquireContext(void)
OpenGL OSD Vertex Buffers.
Definition openglosd.h:299
int m_sizeVertex2
Definition openglosd.h:326
GLuint m_positionLoc
Definition openglosd.h:323
virtual ~cOglVb(void)
Definition openglosd.h:302
void EnableBlending(void)
eVertexBufferType m_type
Definition openglosd.h:319
int m_sizeVertex1
Definition openglosd.h:325
int m_numVertices
Definition openglosd.h:327
eShaderType m_shader
Definition openglosd.h:320
void SetShaderColor(GLint)
GLuint m_vao
Definition openglosd.h:321
GLuint m_texCoordsLoc
Definition openglosd.h:324
void SetShaderTexture(GLint)
void DisableBlending(void)
void SetVertexSubData(GLfloat *, int count=0)
void Bind(void)
void SetShaderProjectionMatrix(GLint, GLint)
void SetVertexData(GLfloat *, int count=0)
void DrawArrays(int count=0)
void ActivateShader(void)
GLuint m_vbo
Definition openglosd.h:322
void SetShaderAlpha(GLint)
bool Init(void)
cOglVb(int type)
Definition openglosd.h:301
void Unbind(void)
void SetShaderBorderColor(GLint)
GLuint m_drawMode
Definition openglosd.h:328
Output Device Implementation.
Video Renderer.
#define BORDERCOLOR
OpenGL OSD (GPU)
Definition openglosd.h:53
#define OGL_MAX_OSDIMAGES
Definition openglosd.h:696
const char * message
Definition openglosd.h:34
#define MIN_CHARCODE
Definition openglosd.h:163
const struct @0 FT_Errors[]
int code
Definition openglosd.h:33
eShaderType
Definition openglosd.h:62
@ stText
Definition openglosd.h:66
@ stCount
Definition openglosd.h:67
@ stTextureSwapBR
Definition openglosd.h:65
@ stRect
Definition openglosd.h:63
@ stTexture
Definition openglosd.h:64
eVertexBufferType
Definition openglosd.h:282
@ vbSlope
Definition openglosd.h:285
@ vbCount
Definition openglosd.h:289
@ vbText
Definition openglosd.h:288
@ vbTexture
Definition openglosd.h:286
@ vbEllipse
Definition openglosd.h:284
@ vbRect
Definition openglosd.h:283
@ vbTextureSwapBR
Definition openglosd.h:287
#define MAX_CHARCODE
Definition openglosd.h:164
tKerning(FT_ULong prevSym, GLfloat kerning=0.0f)
Definition openglosd.h:121
GLint height
Definition openglosd.h:58
bool used
Definition openglosd.h:59
GLint width
Definition openglosd.h:57
GLuint texture
Definition openglosd.h:56