vdr-plugin-softhddevice-drm-gles 1.6.8-daba64b
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
469public:
476 virtual ~cOglCmdRenderFbToFb(void) {};
477 virtual const char* Description(void) { return "Render framebuffer"; }
478 virtual bool Execute(void);
479private:
484};
485
491class cOglCmdFill : public cOglCmd {
492public:
496 virtual ~cOglCmdFill(void) {};
497 virtual const char* Description(void) { return "Fill"; }
498 virtual bool Execute(void);
499private:
501};
502
509public:
513 virtual ~cOglCmdBufferFill(void) {};
514 virtual const char* Description(void) { return "Fill Buffer "; }
515 virtual bool Execute(void);
516private:
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) {};
534 virtual ~cOglCmdDrawRectangle(void) {};
535 virtual const char* Description(void) { return "DrawRectangle"; }
536 virtual bool Execute(void);
537private:
541};
542
549public:
551 : cOglCmd(fb),
552 m_x(x),
553 m_y(y),
554 m_width(width),
555 m_height(height),
556 m_color(color),
558 virtual ~cOglCmdDrawEllipse(void) {};
559 virtual const char* Description(void) { return "DrawEllipse "; }
560 virtual bool Execute(void);
561private:
566
570};
571
577class cOglCmdDrawSlope : public cOglCmd {
578public:
580 : cOglCmd(fb),
581 m_x(x),
582 m_y(y),
583 m_width(width),
584 m_height(height),
585 m_color(color),
586 m_type(type) {};
587 virtual ~cOglCmdDrawSlope(void) {};
588 virtual const char* Description(void) { return "DrawSlope "; }
589 virtual bool Execute(void);
590private:
595};
596
602class cOglCmdDrawText : public cOglCmd {
603public:
604 cOglCmdDrawText(cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name, int fontSize, tColor colorText, int length)
605 : cOglCmd(fb),
606 m_x(x),
607 m_y(y),
611 m_fontName(name),
614 virtual ~cOglCmdDrawText(void) { free(m_pSymbols); };
615 virtual const char* Description(void) { return "DrawText "; }
616 virtual bool Execute(void);
617private:
624 unsigned int *m_pSymbols;
625};
626
632class cOglCmdDrawImage : public cOglCmd {
633public:
634 cOglCmdDrawImage(cOglFb *fb, tColor *argb, GLint width, GLint height, GLint x, GLint y, bool overlay = true, double scaleX = 1.0f, double scaleY = 1.0f)
635 : cOglCmd(fb),
636 m_argb(argb),
637 m_x(x),
638 m_y(y),
639 m_width(width),
640 m_height(height),
645 virtual ~cOglCmdDrawImage(void) { free(m_argb); };
646 virtual const char* Description(void) { return "Draw Image"; }
647 virtual bool Execute(void);
648private:
654};
655
662public:
663 cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y, double scaleX = 1.0f, double scaleY = 1.0f)
664 : cOglCmd(fb),
666 m_x(x),
667 m_y(y),
671 virtual ~cOglCmdDrawTexture(void) {};
672 virtual const char* Description(void) { return "Draw Texture"; }
673 virtual bool Execute(void);
674private:
679};
680
687public:
692 virtual ~cOglCmdStoreImage(void) { free(m_pData); };
693 virtual const char* Description(void) { return "Store Image"; }
694 virtual bool Execute(void);
695private:
698};
699
705class cOglCmdDropImage : public cOglCmd {
706public:
711 virtual ~cOglCmdDropImage(void) {};
712 virtual const char* Description(void) { return "Drop Image"; }
713 virtual bool Execute(void);
714private:
717};
718
719#define OGL_MAX_OSDIMAGES 512
720#define OGL_CMDQUEUE_SIZE 200
721
736class cOglThread : public cThread {
737public:
739 virtual ~cOglThread(void) {};
740
741 void RequestStop(void);
742 void Stop(void);
743 void DoCmd(cOglCmd*);
744 int StoreImage(const cImage &);
745 void DropImageData(int);
747 int MaxTextureSize(void) { return m_maxTextureSize; };
748 void LockOutputFb(void) { m_mutex.lock(); };
749 void UnlockOutputFb(void) { m_mutex.unlock(); };
750protected:
751 virtual void Action(void);
752private:
755 bool m_stalled = false;
756 std::queue<cOglCmd*> m_commands;
759 long m_memCached = 0;
762 std::mutex m_mutex;
763
764 bool InitOpenGL(void);
765 bool InitShaders(void);
766 void DeleteShaders(void);
767 bool InitVertexBuffers(void);
768 void DeleteVertexBuffers(void);
769 void Cleanup(void);
770 void CleanupImageCache(void);
771 int GetFreeSlot(void);
772 void ClearSlot(int slot);
773 void eglAcquireContext(void);
774};
775
781class cOglPixmap : public cPixmap {
782public:
783 cOglPixmap(std::shared_ptr<cOglThread>, int, const cRect &, const cRect &DrawPort = cRect::Null);
784 virtual ~cOglPixmap(void);
785
786 cOglFb *Framebuffer(void) const { return m_pFramebuffer; };
787 int X(void) { return ViewPort().X(); };
788 int Y(void) { return ViewPort().Y(); };
789 virtual bool IsDirty(void) { return m_dirty; }
790 virtual void SetDirty(bool dirty = true) { m_dirty = dirty; }
791 virtual void SetLayer(int);
792 virtual void SetAlpha(int);
793 virtual void SetTile(bool);
794 virtual void SetViewPort(const cRect &);
795 virtual void SetDrawPortPoint(const cPoint &, bool Dirty = true);
796 virtual void Clear(void);
797 virtual void Fill(tColor);
798 virtual void DrawImage(const cPoint &, const cImage &);
799 virtual void DrawImage(const cPoint &, int);
800 virtual void DrawScaledImage(const cPoint &, const cImage &, double FactorX = 1.0f, double FactorY = 1.0f, bool AntiAlias = false);
801 virtual void DrawScaledImage(const cPoint &, int, double FactorX = 1.0f, double FactorY = 1.0f, bool AntiAlias = false);
802 virtual void DrawPixel(const cPoint &, tColor);
803 virtual void DrawBitmap(const cPoint &, const cBitmap &, tColor ColorFg = 0, tColor ColorBg = 0, bool Overlay = false);
804 virtual void DrawText(const cPoint &, const char *, tColor, tColor, const cFont *, int Width = 0, int Height = 0, int Alignment = taDefault);
805 virtual void DrawRectangle(const cRect &, tColor);
806 virtual void DrawEllipse(const cRect &, tColor, int Quadrants = 0);
807 virtual void DrawSlope(const cRect &, tColor, int);
808 virtual void Render(const cPixmap *, const cRect &, const cPoint &);
809 virtual void Copy(const cPixmap *, const cRect &, const cPoint &);
810 virtual void Scroll(const cPoint &, const cRect &Source = cRect::Null);
811 virtual void Pan(const cPoint &, const cRect &Source = cRect::Null);
812 virtual void MarkViewPortDirty(const cRect &);
813 virtual void SetClean(void);
814private:
816 std::shared_ptr<cOglThread> m_pOglThread;
817 bool m_dirty = true;
818#ifdef GRIDPOINTS
820
821 void DrawGridRect(const cRect &, int, int, tColor, tColor, const cFont *);
822 void DrawGridText(const cPoint &, const char *, tColor, tColor, const cFont *, int Width = 0, int Height = 0, int Alignment = taDefault);
823#endif
824 void DrawTextInternal(const cPoint &, const char *, tColor, tColor, const cFont *, int Width = 0, int Height = 0, int Alignment = taDefault, bool isGridText = false);
825 void RenderPixmapInternal(const cPixmap *, const cRect &, const cPoint &, bool);
826};
827
833class cOglOsd : public cOsd {
834public:
835 cOglOsd(int, int, uint, std::shared_ptr<cOglThread>, cSoftHdDevice *);
836 virtual ~cOglOsd();
837
838 virtual eOsdError SetAreas(const tArea *, int);
839 virtual cPixmap *CreatePixmap(int, const cRect &, const cRect &DrawPort = cRect::Null);
840 virtual void DestroyPixmap(cPixmap *);
841 virtual void Flush(void);
842 virtual const cSize &MaxPixmapSize(void) const { return m_maxPixmapSize; };
843 virtual void DrawScaledBitmap(int, int, const cBitmap &, double, double, bool AntiAlias = false);
844
846private:
849 std::shared_ptr<cOglThread> m_pOglThread;
855};
856
857#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:508
virtual ~cOglCmdBufferFill(void)
Definition openglosd.h:513
cOglCmdBufferFill(cOglFb *fb, GLint color)
Definition openglosd.h:510
virtual const char * Description(void)
Definition openglosd.h:514
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:548
virtual ~cOglCmdDrawEllipse(void)
Definition openglosd.h:558
GLfloat * CreateVerticesFull(int &)
GLfloat * CreateVerticesHalf(int &)
GLfloat * CreateVerticesQuadrant(int &)
virtual const char * Description(void)
Definition openglosd.h:559
virtual bool Execute(void)
cOglCmdDrawEllipse(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint quadrants)
Definition openglosd.h:550
OpenGL command: Draw an image.
Definition openglosd.h:632
virtual bool Execute(void)
virtual ~cOglCmdDrawImage(void)
Definition openglosd.h:645
virtual const char * Description(void)
Definition openglosd.h:646
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:634
tColor * m_argb
Definition openglosd.h:649
OpenGL command: Draw a rectangle.
Definition openglosd.h:525
virtual bool Execute(void)
cOglCmdDrawRectangle(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color)
Definition openglosd.h:527
virtual ~cOglCmdDrawRectangle(void)
Definition openglosd.h:534
virtual const char * Description(void)
Definition openglosd.h:535
OpenGL command: Draw a slope.
Definition openglosd.h:577
virtual bool Execute(void)
virtual const char * Description(void)
Definition openglosd.h:588
virtual ~cOglCmdDrawSlope(void)
Definition openglosd.h:587
cOglCmdDrawSlope(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint type)
Definition openglosd.h:579
OpenGL command: Draw a text.
Definition openglosd.h:602
cOglCmdDrawText(cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name, int fontSize, tColor colorText, int length)
Definition openglosd.h:604
cString m_fontName
Definition openglosd.h:622
unsigned int * m_pSymbols
Definition openglosd.h:624
virtual bool Execute(void)
virtual ~cOglCmdDrawText(void)
Definition openglosd.h:614
virtual const char * Description(void)
Definition openglosd.h:615
OpenGL command: Draw a texture.
Definition openglosd.h:661
virtual const char * Description(void)
Definition openglosd.h:672
virtual bool Execute(void)
virtual ~cOglCmdDrawTexture(void)
Definition openglosd.h:671
sOglImage * m_pImageRef
Definition openglosd.h:675
cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y, double scaleX=1.0f, double scaleY=1.0f)
Definition openglosd.h:663
OpenGL command: Drop image from cache.
Definition openglosd.h:705
virtual ~cOglCmdDropImage(void)
Definition openglosd.h:711
cOglCmdDropImage(sOglImage *imageRef, cCondWait *wait)
Definition openglosd.h:707
virtual const char * Description(void)
Definition openglosd.h:712
sOglImage * m_pImageRef
Definition openglosd.h:715
cCondWait * m_pWait
Definition openglosd.h:716
virtual bool Execute(void)
OpenGL command: Fill a polygon.
Definition openglosd.h:491
virtual const char * Description(void)
Definition openglosd.h:497
cOglCmdFill(cOglFb *fb, GLint color)
Definition openglosd.h:493
GLint m_color
Definition openglosd.h:500
virtual ~cOglCmdFill(void)
Definition openglosd.h:496
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: Render a framebuffer into another one.
Definition openglosd.h:468
cOglCmdRenderFbToFb(cOglFb *dstFb, cOglFb *srcFb, const cRect &src, const cPoint &dst, int alpha)
Definition openglosd.h:470
virtual bool Execute(void)
virtual const char * Description(void)
Definition openglosd.h:477
virtual ~cOglCmdRenderFbToFb(void)
Definition openglosd.h:476
OpenGL command: Store image in the cache.
Definition openglosd.h:686
sOglImage * m_pImageRef
Definition openglosd.h:696
virtual bool Execute(void)
cOglCmdStoreImage(sOglImage *imageRef, tColor *argb)
Definition openglosd.h:688
virtual ~cOglCmdStoreImage(void)
Definition openglosd.h:692
virtual const char * Description(void)
Definition openglosd.h:693
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:833
virtual ~cOglOsd()
std::shared_ptr< cOglThread > m_pOglThread
pointer to thread, which executes the commands
Definition openglosd.h:849
bool m_isSubtitleOsd
true, if this is a subtitle osd
Definition openglosd.h:851
cSoftHdDevice * m_pDevice
pointer to cSofthdDevice
Definition openglosd.h:854
cOglFb * m_pBufferFramebuffer
all pixmaps are composed onto this framebuffer after each other, before this one is blit onto the OSD...
Definition openglosd.h:847
static cOglOutputFb * OutputFramebuffer
main OSD output framebuffer - this keeps our finished "OSD" (one per OSD)
Definition openglosd.h:845
virtual void Flush(void)
virtual eOsdError SetAreas(const tArea *, int)
cRect m_pDirtyViewport
the dirty viewport
Definition openglosd.h:853
virtual void DrawScaledBitmap(int, int, const cBitmap &, double, double, bool AntiAlias=false)
virtual const cSize & MaxPixmapSize(void) const
Definition openglosd.h:842
virtual cPixmap * CreatePixmap(int, const cRect &, const cRect &DrawPort=cRect::Null)
cVector< cOglPixmap * > m_pOglPixmaps
array of pixmaps
Definition openglosd.h:850
cSize m_maxPixmapSize
maximum allowed size of a pixmap (depends on the maximum OpenGL texture size)
Definition openglosd.h:852
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:781
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:787
virtual bool IsDirty(void)
Definition openglosd.h:789
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:815
std::shared_ptr< cOglThread > m_pOglThread
Definition openglosd.h:816
int Y(void)
Definition openglosd.h:788
virtual void SetTile(bool)
virtual void SetDirty(bool dirty=true)
Definition openglosd.h:790
virtual void MarkViewPortDirty(const cRect &)
virtual void Scroll(const cPoint &, const cRect &Source=cRect::Null)
cOglFb * Framebuffer(void) const
Definition openglosd.h:786
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:817
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 &)
void RenderPixmapInternal(const cPixmap *, const cRect &, const cPoint &, bool)
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:736
long m_memCached
Definition openglosd.h:759
void DoCmd(cOglCmd *)
long m_maxCacheSize
Definition openglosd.h:760
bool InitOpenGL(void)
bool InitVertexBuffers(void)
bool m_stalled
Definition openglosd.h:755
void CleanupImageCache(void)
sOglImage m_imageCache[OGL_MAX_OSDIMAGES]
Definition openglosd.h:758
int GetFreeSlot(void)
void Stop(void)
bool InitShaders(void)
void UnlockOutputFb(void)
Definition openglosd.h:749
void LockOutputFb(void)
Definition openglosd.h:748
virtual ~cOglThread(void)
Definition openglosd.h:739
cCondWait * m_startWait
Definition openglosd.h:753
cCondWait m_wait
Definition openglosd.h:754
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:761
int MaxTextureSize(void)
Definition openglosd.h:747
sOglImage * GetImageRef(int)
std::mutex m_mutex
Definition openglosd.h:762
GLint m_maxTextureSize
Definition openglosd.h:757
void DeleteVertexBuffers(void)
std::queue< cOglCmd * > m_commands
Definition openglosd.h:756
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:719
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