vdr-plugin-softhddevice-drm-gles 1.5.9-20e15de
openglosd.h
Go to the documentation of this file.
1
22#ifndef __SOFTHDDEVICE_OPENGLOSD_H
23#define __SOFTHDDEVICE_OPENGLOSD_H
24
25#include <cstdio>
26#include <memory>
27#include <queue>
28
29#include <ft2build.h>
30#include FT_FREETYPE_H
31#include FT_LCD_FILTER_H
32#include FT_STROKER_H
33
34#undef __FTERRORS_H__
35#define FT_ERRORDEF( e, v, s ) { e, s },
36#define FT_ERROR_START_LIST {
37#define FT_ERROR_END_LIST { 0, 0 } };
38const struct {
39 int code;
40 const char* message;
41} FT_Errors[] =
42#include FT_ERRORS_H
43
44#include <GLES2/gl2.h>
45#include <glm/glm.hpp>
46#include <glm/gtc/matrix_transform.hpp>
47
48#include <vdr/osd.h>
49
50// This is needed for the GLES2 GL_CLAMP_TO_BORDER workaround
51#define BORDERCOLOR 0x00000000
52
53struct sOglImage {
54 GLuint texture;
55 GLint width;
56 GLint height;
57 bool used;
58};
59
60class cSoftHdDevice;
61class cVideoRender;
62
63/****************************************************************************************
64 * cOglShader
65 *
66 * Represents a shader and keeps everything we need to set variable within the shader.
67 ***************************************************************************************/
75
77{
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);
87 void SetVector4f (const GLchar *, GLfloat, GLfloat, GLfloat, GLfloat);
88 void SetMatrix4 (const GLchar *, const glm::mat4 &);
89
90private:
92 GLuint m_id;
93
94 bool Compile(const char *, const char *);
95 bool CheckCompileErrors(GLuint, bool program = false);
96};
97
98/****************************************************************************************
99 * cOglGlyph
100 *
101 * Represents a single glyph of a font.
102 ***************************************************************************************/
103class cOglGlyph : public cListObject
104{
105public:
106 cOglGlyph(FT_ULong, FT_BitmapGlyph);
107 virtual ~cOglGlyph();
108
109 FT_ULong CharCode(void) { return m_charCode; }
110 int AdvanceX(void) { return m_advanceX; }
111 int BearingLeft(void) const { return m_bearingLeft; }
112 int BearingTop(void) const { return m_bearingTop; }
113 int Width(void) const { return m_width; }
114 int Height(void) const { return m_height; }
115 int GetKerningCache(FT_ULong);
116 void SetKerningCache(FT_ULong, int);
117 void LoadTexture(void);
118 void BindTexture(void);
119protected:
120 struct tKerning {
121 public:
122 tKerning(FT_ULong prevSym, GLfloat kerning = 0.0f) {
123 this->prevSym = prevSym;
124 this->kerning = kerning;
125 }
126 FT_ULong prevSym;
127 GLfloat kerning;
128 };
129 FT_ULong m_charCode;
134 unsigned char *m_pBuffer;
136 cVector<tKerning> m_pKerningCache;
137 GLuint m_texture = 0;
138};
139
140/****************************************************************************************
141 * cOglAtlasGlyph
142 *
143 * A glyph a font-atlas (texture-atlas) needs some more infos like offset on the texture.
144 ***************************************************************************************/
146{
147public:
148 cOglAtlasGlyph(FT_ULong charCode, FT_BitmapGlyph ftGlyph, float offsetX, float offsetY)
149 : cOglGlyph(charCode, ftGlyph),
150 m_advanceY(ftGlyph->root.advance.y >> 16), // value in 1/2^16 pixel
151 m_offsetX(offsetX),
152 m_offsetY(offsetY) {};
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/****************************************************************************************
164 * cOglFontAtlas
165 *
166 * Represents a texture atlas keeping a range of glyphs on one texture per font and size
167 * instead of having one texture per glyph. This technique makes dealing with huge
168 * amounts of glyphs faster, because the bottleneck (texture up-/download/binding) is
169 * reduced at a minimum. Its faster to deal with one single bigger texture than many
170 * smaller ones.
171 *
172 * The font atlas is prepared once at the time the new font or sized is accessed for the
173 * first time. We may have a little delay at startup, which is negligible.
174 ****************************************************************************************/
175#define MIN_CHARCODE 32
176#define MAX_CHARCODE 255
178{
179public:
180 cOglFontAtlas(FT_Face, int);
181 virtual ~cOglFontAtlas(void);
182 cOglAtlasGlyph* GetGlyph(int) const;
183 int Height(void) const { return m_height; }
184 int Width(void) const { return m_width; }
185 void BindTexture(void);
186private:
187 GLuint m_texture = 0;
188 int m_width = 0;
189 int m_height = 0;
191};
192
193/****************************************************************************************
194 * cOglFont
195 *
196 * Represents a OSD font (one per size and font family)
197 ***************************************************************************************/
198class cOglFont : public cListObject
199{
200public:
201 virtual ~cOglFont(void);
202 static cOglFont *Get(const char *, int);
203 cOglFontAtlas *Atlas(void) { return m_pAtlas; };
204 static void Cleanup(void);
205 const char *Name(void) { return *m_name; };
206 int Size(void) { return m_size; };
207 int Bottom(void) {return m_bottom; };
208 int Height(void) {return m_height; };
209 cOglGlyph* Glyph(FT_ULong) const;
210 int Kerning(cOglGlyph *glyph, FT_ULong prevSym) const;
211private:
212 static bool s_initiated;
213 static FT_Library s_ftLib;
214 static cList<cOglFont> *s_pFonts;
215
216 cString m_name;
218 int m_height = 0;
219 int m_bottom = 0;
220 FT_Face m_face;
221 mutable cList<cOglGlyph> m_glyphCache;
223
224 cOglFont(const char *, int);
225 static void Init(void);
226};
227
228/****************************************************************************************
229 * cOglFb
230 *
231 * A framebuffer object which can be rendered onto (pixmap)
232 ****************************************************************************************/
234{
235public:
236 cOglFb(GLint, GLint, GLint, GLint);
237 virtual ~cOglFb(void);
238
239 bool Initiated(void) { return m_initiated; }
240 virtual bool Init(void);
241 void Bind(void);
242 virtual void Unbind(void);
243 bool BindTexture(void);
244 void Blit(GLint, GLint, GLint, GLint);
245 GLint Width(void) { return m_width; };
246 GLint Height(void) { return m_height; };
247 bool Scrollable(void) { return m_scrollable; };
248 GLint ViewportWidth(void) { return m_viewPortWidth; };
249 GLint ViewportHeight(void) { return m_viewPortHeight; };
250protected:
251 bool m_initiated = false;
253private:
254 GLuint m_framebuffer = 0;
255 GLuint m_texture = 0;
257 bool m_scrollable = false;
258};
259
260/****************************************************************************************
261 * cOglOutputFb
262 *
263 * Output Framebuffer Object - holds the texture which is our "OSD output framebuffer"
264 ***************************************************************************************/
265class cOglOutputFb : public cOglFb
266{
267public:
268 cOglOutputFb(GLint width, GLint height) : cOglFb(width, height, width, height) {};
269
270 virtual bool Init(void);
271 virtual void Unbind(void);
272private:
273 GLuint m_framebuffer = 0;
274 GLuint m_texture = 0;
275};
276
277/****************************************************************************************
278 * cOglVb
279 *
280 * Describes and handles the OpenGL vertices for the different drawing commands
281 ***************************************************************************************/
291
293{
294public:
295 cOglVb(int type) : m_type((eVertexBufferType)type) {};
296 virtual ~cOglVb(void) {};
297
298 bool Init(void);
299 void Bind(void);
300 void Unbind(void);
301 void ActivateShader(void);
302 void EnableBlending(void);
303 void DisableBlending(void);
304 void SetShaderColor(GLint);
305 void SetShaderBorderColor(GLint);
306 void SetShaderTexture(GLint);
307 void SetShaderAlpha(GLint);
308 void SetShaderProjectionMatrix(GLint, GLint);
309 void SetVertexSubData(GLfloat *, int count = 0);
310 void SetVertexData(GLfloat *, int count = 0);
311 void DrawArrays(int count = 0);
312private:
315 GLuint m_vao;
316 GLuint m_vbo = 0;
317 GLuint m_positionLoc = 0;
318 GLuint m_texCoordsLoc = 1;
322 GLuint m_drawMode = 0;
323};
324
325/****************************************************************************************
326 * cOglCmd and derived classes
327 *
328 * Every draw action is transposed to one of the following cOglCmd* methods,
329 * which are sent to the command queue, executed by cOglThread.
330 ***************************************************************************************/
332{
333public:
335 : m_pFramebuffer(fb) {};
336 virtual ~cOglCmd(void) {};
337 virtual const char* Description(void) = 0;
338 virtual bool Execute(void) = 0;
339protected:
341};
342
344{
345public:
349 virtual ~cOglCmdInitOutputFb(void) {};
350 virtual const char* Description(void) { return "InitOutputFramebuffer"; }
351 virtual bool Execute(void);
352private:
354};
355
356class cOglCmdInitFb : public cOglCmd
357{
358public:
359 cOglCmdInitFb(cOglFb *fb, cCondWait *wait = NULL)
360 : cOglCmd(fb),
361 m_wait(wait) {};
362 virtual ~cOglCmdInitFb(void) {};
363 virtual const char* Description(void) { return "InitFramebuffer"; }
364 virtual bool Execute(void);
365private:
366 cCondWait *m_wait;
367};
368
370{
371public:
373 : cOglCmd(fb) {};
374 virtual ~cOglCmdDeleteFb(void) {};
375 virtual const char* Description(void) { return "DeleteFramebuffer"; }
376 virtual bool Execute(void);
377};
378
380{
381public:
382 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, cSoftHdDevice *device)
383 : cOglCmd(fb),
384 m_pBuffer(buffer),
385 m_x((GLfloat)x),
386 m_y((GLfloat)y),
387 m_drawPortX((GLfloat)drawPortX),
388 m_drawPortY((GLfloat)drawPortY),
389 m_transparency((alphablending ? transparency : ALPHA_OPAQUE)),
391 m_dirtyX(dirtyX),
392 m_dirtyTop(dirtyTop),
393 m_dirtyWidth(dirtyWidth),
394 m_dirtyHeight(dirtyHeight),
395 m_alphablending(alphablending),
396 m_pDevice(device) {};
398 virtual const char* Description(void) { return "Render Framebuffer to Buffer"; }
399 virtual bool Execute(void);
400private:
402 GLfloat m_x, m_y;
405 GLint m_bcolor;
406 GLint m_dirtyX;
412};
413
415{
416public:
417 cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputFb *oFb, GLint x, GLint y, int active, cSoftHdDevice *device)
418 : cOglCmd(fb),
420 m_x((GLfloat)x),
421 m_y((GLfloat)y),
423 m_active(active),
424 m_pDevice(device) {};
426 virtual const char* Description(void) { return "Copy buffer to OutputFramebuffer"; }
427 virtual bool Execute(void);
428private:
430 GLfloat m_x, m_y;
434};
435
436class cOglCmdFill : public cOglCmd
437{
438public:
439 cOglCmdFill(cOglFb *fb, GLint color)
440 : cOglCmd(fb),
441 m_color(color) {};
442 virtual ~cOglCmdFill(void) {};
443 virtual const char* Description(void) { return "Fill"; }
444 virtual bool Execute(void);
445private:
446 GLint m_color;
447};
448
450{
451public:
452 cOglCmdBufferFill(cOglFb *fb, GLint color)
453 : cOglCmd(fb),
454 m_color(color) {};
455 virtual ~cOglCmdBufferFill(void) {};
456 virtual const char* Description(void) { return "Fill Buffer "; }
457 virtual bool Execute(void);
458private:
459 GLint m_color;
460};
461
463{
464public:
465 cOglCmdDrawRectangle( cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color)
466 : cOglCmd(fb),
467 m_x(x),
468 m_y(y),
469 m_width(width),
470 m_height(height),
471 m_color(color) {};
472 virtual ~cOglCmdDrawRectangle(void) {};
473 virtual const char* Description(void) { return "DrawRectangle"; }
474 virtual bool Execute(void);
475private:
476 GLint m_x, m_y;
478 GLint m_color;
479};
480
482{
483public:
484 cOglCmdDrawEllipse( cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint quadrants)
485 : cOglCmd(fb),
486 m_x(x),
487 m_y(y),
488 m_width(width),
489 m_height(height),
490 m_color(color),
491 m_quadrants(quadrants) {};
492 virtual ~cOglCmdDrawEllipse(void) {};
493 virtual const char* Description(void) { return "DrawEllipse "; }
494 virtual bool Execute(void);
495private:
496 GLint m_x, m_y;
498 GLint m_color;
500
501 GLfloat *CreateVerticesFull(int &);
502 GLfloat *CreateVerticesQuadrant(int &);
503 GLfloat *CreateVerticesHalf(int &);
504};
505
507{
508public:
509 cOglCmdDrawSlope( cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint type)
510 : cOglCmd(fb),
511 m_x(x),
512 m_y(y),
513 m_width(width),
514 m_height(height),
515 m_color(color),
516 m_type(type) {};
517 virtual ~cOglCmdDrawSlope(void) {};
518 virtual const char* Description(void) { return "DrawSlope "; }
519 virtual bool Execute(void);
520private:
521 GLint m_x, m_y;
523 GLint m_color;
524 GLint m_type;
525};
526
528{
529public:
530 cOglCmdDrawText(cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name, int fontSize, tColor colorText, int length)
531 : cOglCmd(fb),
532 m_x(x),
533 m_y(y),
534 m_limitX(limitX),
535 m_colorText(colorText),
536 m_length(length),
537 m_fontName(name),
538 m_fontSize(fontSize),
539 m_pSymbols(symbols) {};
540 virtual ~cOglCmdDrawText(void) { free(m_pSymbols); };
541 virtual const char* Description(void) { return "DrawText "; }
542 virtual bool Execute(void);
543private:
544 GLint m_x, m_y;
545 GLint m_limitX;
548 cString m_fontName;
550 unsigned int *m_pSymbols;
551};
552
554{
555public:
556 cOglCmdDrawImage(cOglFb *fb, tColor *argb, GLint width, GLint height, GLint x, GLint y, bool overlay = true, double scaleX = 1.0f, double scaleY = 1.0f)
557 : cOglCmd(fb),
558 m_argb(argb),
559 m_x(x),
560 m_y(y),
561 m_width(width),
562 m_height(height),
563 m_overlay(overlay),
564 m_scaleX(scaleX),
565 m_scaleY(scaleY),
567 virtual ~cOglCmdDrawImage(void) { free(m_argb); };
568 virtual const char* Description(void) { return "Draw Image"; }
569 virtual bool Execute(void);
570private:
571 tColor *m_argb;
576};
577
579{
580public:
581 cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y, double scaleX = 1.0f, double scaleY = 1.0f)
582 : cOglCmd(fb),
583 m_pImageRef(imageRef),
584 m_x(x),
585 m_y(y),
586 m_scaleX(scaleX),
587 m_scaleY(scaleY),
589 virtual ~cOglCmdDrawTexture(void) {};
590 virtual const char* Description(void) { return "Draw Texture"; }
591 virtual bool Execute(void);
592private:
593 sOglImage *m_pImageRef;
594 GLint m_x, m_y;
597};
598
600{
601public:
602 cOglCmdStoreImage(sOglImage *imageRef, tColor *argb)
603 : cOglCmd(NULL),
604 m_pImageRef(imageRef),
605 m_pData(argb) {};
606 virtual ~cOglCmdStoreImage(void) { free(m_pData); };
607 virtual const char* Description(void) { return "Store Image"; }
608 virtual bool Execute(void);
609private:
610 sOglImage *m_pImageRef;
611 tColor *m_pData;
612};
613
615{
616public:
617 cOglCmdDropImage(sOglImage *imageRef, cCondWait *wait)
618 : cOglCmd(NULL),
619 m_pImageRef(imageRef),
620 m_pWait(wait) {};
621 virtual ~cOglCmdDropImage(void) {};
622 virtual const char* Description(void) { return "Drop Image"; }
623 virtual bool Execute(void);
624private:
625 sOglImage *m_pImageRef;
626 cCondWait *m_pWait;
627};
628
629/******************************************************************************
630 * cOglThread
631 *
632 * Every OSD draw or flush which is invoked by VDR is transposed into an
633 * OpenGL command.
634 * cOglThread holds a fifo-queue of these commands. It continuosly checks
635 * for commands on the queue, pops them and sends them to the hardware.
636 *
637 * On startup it initiates all necessary OpenGL bits.
638 *****************************************************************************/
639#define OGL_MAX_OSDIMAGES 512
640#define OGL_CMDQUEUE_SIZE 200
641
642class cOglThread : public cThread
643{
644public:
645 cOglThread(cCondWait *startWait, int maxCacheSize, cSoftHdDevice *device);
646 virtual ~cOglThread(void) {};
647
648 void Stop(void);
649 void DoCmd(cOglCmd*);
650 int StoreImage(const cImage &);
651 void DropImageData(int);
652 sOglImage *GetImageRef(int);
653 int MaxTextureSize(void) { return m_maxTextureSize; };
654protected:
655 virtual void Action(void);
656private:
657 cCondWait *m_startWait;
658 cCondWait m_wait;
659 bool m_stalled = false;
660 std::queue<cOglCmd*> m_commands;
663 long m_memCached = 0;
666
667 bool InitOpenGL(void);
668 bool InitShaders(void);
669 void DeleteShaders(void);
670 bool InitVertexBuffers(void);
671 void DeleteVertexBuffers(void);
672 void Cleanup(void);
673 int GetFreeSlot(void);
674 void ClearSlot(int slot);
675 void eglAcquireContext(void);
676 void eglReleaseContext(void);
677};
678
679/****************************************************************************************
680 * cOglPixmap
681 *
682 * OpenGL implementation of a cPixmap
683 ***************************************************************************************/
684class cOglPixmap : public cPixmap
685{
686public:
687 cOglPixmap(std::shared_ptr<cOglThread>, int, const cRect &, const cRect &DrawPort = cRect::Null);
688 virtual ~cOglPixmap(void);
689
691 int X(void) { return ViewPort().X(); };
692 int Y(void) { return ViewPort().Y(); };
693 virtual bool IsDirty(void) { return m_dirty; }
694 virtual void SetDirty(bool dirty = true) { m_dirty = dirty; }
695 virtual void SetLayer(int);
696 virtual void SetAlpha(int);
697 virtual void SetTile(bool);
698 virtual void SetViewPort(const cRect &);
699 virtual void SetDrawPortPoint(const cPoint &, bool Dirty = true);
700 virtual void Clear(void);
701 virtual void Fill(tColor);
702 virtual void DrawImage(const cPoint &, const cImage &);
703 virtual void DrawImage(const cPoint &, int);
704 virtual void DrawScaledImage(const cPoint &, const cImage &, double FactorX = 1.0f, double FactorY = 1.0f, bool AntiAlias = false);
705 virtual void DrawScaledImage(const cPoint &, int, double FactorX = 1.0f, double FactorY = 1.0f, bool AntiAlias = false);
706 virtual void DrawPixel(const cPoint &, tColor);
707 virtual void DrawBitmap(const cPoint &, const cBitmap &, tColor ColorFg = 0, tColor ColorBg = 0, bool Overlay = false);
708 virtual void DrawText(const cPoint &, const char *, tColor, tColor, const cFont *, int Width = 0, int Height = 0, int Alignment = taDefault);
709 virtual void DrawRectangle(const cRect &, tColor);
710 virtual void DrawEllipse(const cRect &, tColor, int Quadrants = 0);
711 virtual void DrawSlope(const cRect &, tColor, int);
712 virtual void Render(const cPixmap *, const cRect &, const cPoint &);
713 virtual void Copy(const cPixmap *, const cRect &, const cPoint &);
714 virtual void Scroll(const cPoint &, const cRect &Source = cRect::Null);
715 virtual void Pan(const cPoint &, const cRect &Source = cRect::Null);
716 virtual void MarkViewPortDirty(const cRect &);
717 virtual void SetClean(void);
718private:
720 std::shared_ptr<cOglThread> m_pOglThread;
721 bool m_dirty = true;
722#ifdef GRIDPOINTS
723 cFont *m_pTinyfont;
724
725 void DrawGridRect(const cRect &, int, int, tColor, tColor, const cFont *);
726 void DrawGridText(const cPoint &, const char *, tColor, tColor, const cFont *, int Width = 0, int Height = 0, int Alignment = taDefault);
727#endif
728 void DrawTextInternal(const cPoint &, const char *, tColor, tColor, const cFont *, int Width = 0, int Height = 0, int Alignment = taDefault, bool isGridText = false);
729};
730
731/******************************************************************************
732 * cOglOsd
733 *
734 * OpenGL implementation of a cOsd
735 *****************************************************************************/
736class cOglOsd : public cOsd
737{
738public:
739 cOglOsd(int, int, uint, std::shared_ptr<cOglThread>, cSoftHdDevice *);
740 virtual ~cOglOsd();
741
742 virtual eOsdError SetAreas(const tArea *, int);
743 virtual cPixmap *CreatePixmap(int, const cRect &, const cRect &DrawPort = cRect::Null);
744 virtual void DestroyPixmap(cPixmap *);
745 virtual void Flush(void);
746 virtual const cSize &MaxPixmapSize(void) const { return m_maxPixmapSize; };
747 virtual void DrawScaledBitmap(int, int, const cBitmap &, double, double, bool AntiAlias = false);
748
750private:
753 std::shared_ptr<cOglThread> m_pOglThread;
754 cVector<cOglPixmap *> m_pOglPixmaps;
759};
760
761#endif
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
virtual ~cOglCmdBufferFill(void)
Definition openglosd.h:455
cOglCmdBufferFill(cOglFb *fb, GLint color)
Definition openglosd.h:452
virtual const char * Description(void)
Definition openglosd.h:456
virtual bool Execute(void)
virtual const char * Description(void)
Definition openglosd.h:426
cOglOutputFb * m_pOutputFramebuffer
Definition openglosd.h:429
virtual ~cOglCmdCopyBufferToOutputFb(void)
Definition openglosd.h:425
virtual bool Execute(void)
cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputFb *oFb, GLint x, GLint y, int active, cSoftHdDevice *device)
Definition openglosd.h:417
cSoftHdDevice * m_pDevice
Definition openglosd.h:433
virtual ~cOglCmdDeleteFb(void)
Definition openglosd.h:374
virtual bool Execute(void)
virtual const char * Description(void)
Definition openglosd.h:375
cOglCmdDeleteFb(cOglFb *fb)
Definition openglosd.h:372
virtual ~cOglCmdDrawEllipse(void)
Definition openglosd.h:492
GLfloat * CreateVerticesFull(int &)
GLfloat * CreateVerticesHalf(int &)
GLfloat * CreateVerticesQuadrant(int &)
virtual const char * Description(void)
Definition openglosd.h:493
virtual bool Execute(void)
cOglCmdDrawEllipse(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint quadrants)
Definition openglosd.h:484
virtual bool Execute(void)
virtual ~cOglCmdDrawImage(void)
Definition openglosd.h:567
virtual const char * Description(void)
Definition openglosd.h:568
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:556
tColor * m_argb
Definition openglosd.h:571
virtual bool Execute(void)
cOglCmdDrawRectangle(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color)
Definition openglosd.h:465
virtual ~cOglCmdDrawRectangle(void)
Definition openglosd.h:472
virtual const char * Description(void)
Definition openglosd.h:473
virtual bool Execute(void)
virtual const char * Description(void)
Definition openglosd.h:518
virtual ~cOglCmdDrawSlope(void)
Definition openglosd.h:517
cOglCmdDrawSlope(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint type)
Definition openglosd.h:509
cOglCmdDrawText(cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name, int fontSize, tColor colorText, int length)
Definition openglosd.h:530
cString m_fontName
Definition openglosd.h:548
unsigned int * m_pSymbols
Definition openglosd.h:550
virtual bool Execute(void)
virtual ~cOglCmdDrawText(void)
Definition openglosd.h:540
virtual const char * Description(void)
Definition openglosd.h:541
virtual const char * Description(void)
Definition openglosd.h:590
virtual bool Execute(void)
virtual ~cOglCmdDrawTexture(void)
Definition openglosd.h:589
sOglImage * m_pImageRef
Definition openglosd.h:593
cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y, double scaleX=1.0f, double scaleY=1.0f)
Definition openglosd.h:581
virtual ~cOglCmdDropImage(void)
Definition openglosd.h:621
cOglCmdDropImage(sOglImage *imageRef, cCondWait *wait)
Definition openglosd.h:617
virtual const char * Description(void)
Definition openglosd.h:622
sOglImage * m_pImageRef
Definition openglosd.h:625
cCondWait * m_pWait
Definition openglosd.h:626
virtual bool Execute(void)
virtual const char * Description(void)
Definition openglosd.h:443
cOglCmdFill(cOglFb *fb, GLint color)
Definition openglosd.h:439
GLint m_color
Definition openglosd.h:446
virtual ~cOglCmdFill(void)
Definition openglosd.h:442
virtual bool Execute(void)
virtual ~cOglCmdInitFb(void)
Definition openglosd.h:362
virtual bool Execute(void)
cOglCmdInitFb(cOglFb *fb, cCondWait *wait=NULL)
Definition openglosd.h:359
virtual const char * Description(void)
Definition openglosd.h:363
cCondWait * m_wait
Definition openglosd.h:366
virtual const char * Description(void)
Definition openglosd.h:350
cOglCmdInitOutputFb(cOglOutputFb *oFb)
Definition openglosd.h:346
cOglOutputFb * m_pOutputFramebuffer
Definition openglosd.h:353
virtual ~cOglCmdInitOutputFb(void)
Definition openglosd.h:349
virtual bool Execute(void)
virtual bool Execute(void)
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, cSoftHdDevice *device)
Definition openglosd.h:382
virtual ~cOglCmdRenderFbToBufferFb(void)
Definition openglosd.h:397
virtual const char * Description(void)
Definition openglosd.h:398
cSoftHdDevice * m_pDevice
Definition openglosd.h:411
sOglImage * m_pImageRef
Definition openglosd.h:610
virtual bool Execute(void)
cOglCmdStoreImage(sOglImage *imageRef, tColor *argb)
Definition openglosd.h:602
virtual ~cOglCmdStoreImage(void)
Definition openglosd.h:606
virtual const char * Description(void)
Definition openglosd.h:607
cOglFb * m_pFramebuffer
Definition openglosd.h:340
virtual bool Execute(void)=0
virtual ~cOglCmd(void)
Definition openglosd.h:336
virtual const char * Description(void)=0
cOglCmd(cOglFb *fb)
Definition openglosd.h:334
GLint m_width
Definition openglosd.h:252
GLuint m_framebuffer
Definition openglosd.h:254
virtual void Unbind(void)
GLint ViewportHeight(void)
Definition openglosd.h:249
GLuint m_texture
Definition openglosd.h:255
void Bind(void)
GLint m_viewPortWidth
Definition openglosd.h:256
GLint Height(void)
Definition openglosd.h:246
void Blit(GLint, GLint, GLint, GLint)
virtual ~cOglFb(void)
GLint ViewportWidth(void)
Definition openglosd.h:248
GLint Width(void)
Definition openglosd.h:245
bool m_scrollable
Definition openglosd.h:257
bool Scrollable(void)
Definition openglosd.h:247
bool Initiated(void)
Definition openglosd.h:239
GLint m_height
Definition openglosd.h:252
bool BindTexture(void)
GLint m_viewPortHeight
Definition openglosd.h:256
virtual bool Init(void)
bool m_initiated
Definition openglosd.h:251
GLuint m_texture
Definition openglosd.h:187
int Width(void) const
Definition openglosd.h:184
cOglAtlasGlyph * GetGlyph(int) const
virtual ~cOglFontAtlas(void)
int Height(void) const
Definition openglosd.h:183
void BindTexture(void)
cOglAtlasGlyph * m_pGlyph[MAX_CHARCODE - MIN_CHARCODE+1]
Definition openglosd.h:190
int Height(void)
Definition openglosd.h:208
int m_size
Definition openglosd.h:217
cString m_name
Definition openglosd.h:216
static void Cleanup(void)
cOglFontAtlas * Atlas(void)
Definition openglosd.h:203
cOglGlyph * Glyph(FT_ULong) const
int Bottom(void)
Definition openglosd.h:207
static void Init(void)
static cOglFont * Get(const char *, int)
virtual ~cOglFont(void)
FT_Face m_face
Definition openglosd.h:220
int Size(void)
Definition openglosd.h:206
cOglFontAtlas * m_pAtlas
Definition openglosd.h:222
int Kerning(cOglGlyph *glyph, FT_ULong prevSym) const
cList< cOglGlyph > m_glyphCache
Definition openglosd.h:221
int m_bottom
Definition openglosd.h:219
int m_height
Definition openglosd.h:218
static bool s_initiated
Definition openglosd.h:212
static FT_Library s_ftLib
Definition openglosd.h:213
const char * Name(void)
Definition openglosd.h:205
static cList< cOglFont > * s_pFonts
Definition openglosd.h:214
int AdvanceX(void)
Definition openglosd.h:110
void BindTexture(void)
int m_advanceX
Definition openglosd.h:135
GLuint m_texture
Definition openglosd.h:137
FT_ULong m_charCode
Definition openglosd.h:129
void LoadTexture(void)
unsigned char * m_pBuffer
Definition openglosd.h:134
int BearingTop(void) const
Definition openglosd.h:112
void SetKerningCache(FT_ULong, int)
int Height(void) const
Definition openglosd.h:114
virtual ~cOglGlyph()
int m_bearingTop
Definition openglosd.h:131
int BearingLeft(void) const
Definition openglosd.h:111
int Width(void) const
Definition openglosd.h:113
FT_ULong CharCode(void)
Definition openglosd.h:109
int GetKerningCache(FT_ULong)
int m_height
Definition openglosd.h:133
int m_bearingLeft
Definition openglosd.h:130
cVector< tKerning > m_pKerningCache
Definition openglosd.h:136
int m_width
Definition openglosd.h:132
virtual ~cOglOsd()
std::shared_ptr< cOglThread > m_pOglThread
pointer to thread, which executes the commands
Definition openglosd.h:753
bool m_isSubtitleOsd
true, if this is a subtitle osd
Definition openglosd.h:755
cSoftHdDevice * m_pDevice
pointer to cSofthdDevice
Definition openglosd.h:758
cOglFb * m_pBufferFramebuffer
all pixmaps are composed onto this framebuffer after each other, before this one is blit onto the OSD...
Definition openglosd.h:751
static cOglOutputFb * OutputFramebuffer
main OSD output framebuffer - this keeps our finished "OSD" (one per OSD)
Definition openglosd.h:749
virtual void Flush(void)
virtual eOsdError SetAreas(const tArea *, int)
cRect m_pDirtyViewport
the dirty viewport
Definition openglosd.h:757
virtual void DrawScaledBitmap(int, int, const cBitmap &, double, double, bool AntiAlias=false)
virtual const cSize & MaxPixmapSize(void) const
Definition openglosd.h:746
virtual cPixmap * CreatePixmap(int, const cRect &, const cRect &DrawPort=cRect::Null)
cVector< cOglPixmap * > m_pOglPixmaps
array of pixmaps
Definition openglosd.h:754
cSize m_maxPixmapSize
maximum allowed size of a pixmap (depends on the maximum OpenGL texture size)
Definition openglosd.h:756
virtual void DestroyPixmap(cPixmap *)
GLuint m_framebuffer
Definition openglosd.h:273
virtual void Unbind(void)
GLuint m_texture
Definition openglosd.h:274
virtual bool Init(void)
cOglOutputFb(GLint width, GLint height)
Definition openglosd.h:268
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:691
virtual bool IsDirty(void)
Definition openglosd.h:693
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:719
std::shared_ptr< cOglThread > m_pOglThread
Definition openglosd.h:720
int Y(void)
Definition openglosd.h:692
cOglFb * Framebuffer(void)
Definition openglosd.h:690
virtual void SetTile(bool)
virtual void SetDirty(bool dirty=true)
Definition openglosd.h:694
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:721
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 &)
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:78
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:83
eShaderType m_type
Definition openglosd.h:91
bool Compile(const char *, const char *)
void SetVector2f(const GLchar *, GLfloat, GLfloat)
long m_memCached
Definition openglosd.h:663
void DoCmd(cOglCmd *)
long m_maxCacheSize
Definition openglosd.h:664
bool InitOpenGL(void)
bool InitVertexBuffers(void)
bool m_stalled
Definition openglosd.h:659
void eglReleaseContext(void)
sOglImage m_imageCache[OGL_MAX_OSDIMAGES]
Definition openglosd.h:662
int GetFreeSlot(void)
void Stop(void)
bool InitShaders(void)
virtual ~cOglThread(void)
Definition openglosd.h:646
cCondWait * m_startWait
Definition openglosd.h:657
cCondWait m_wait
Definition openglosd.h:658
void DropImageData(int)
void Cleanup(void)
void DeleteShaders(void)
virtual void Action(void)
void ClearSlot(int slot)
int StoreImage(const cImage &)
cVideoRender * m_pRender
Definition openglosd.h:665
int MaxTextureSize(void)
Definition openglosd.h:653
sOglImage * GetImageRef(int)
GLint m_maxTextureSize
Definition openglosd.h:661
void DeleteVertexBuffers(void)
std::queue< cOglCmd * > m_commands
Definition openglosd.h:660
void eglAcquireContext(void)
int m_sizeVertex2
Definition openglosd.h:320
GLuint m_positionLoc
Definition openglosd.h:317
virtual ~cOglVb(void)
Definition openglosd.h:296
void EnableBlending(void)
eVertexBufferType m_type
Definition openglosd.h:313
int m_sizeVertex1
Definition openglosd.h:319
int m_numVertices
Definition openglosd.h:321
eShaderType m_shader
Definition openglosd.h:314
void SetShaderColor(GLint)
GLuint m_vao
Definition openglosd.h:315
GLuint m_texCoordsLoc
Definition openglosd.h:318
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:316
void SetShaderAlpha(GLint)
bool Init(void)
cOglVb(int type)
Definition openglosd.h:295
void Unbind(void)
void SetShaderBorderColor(GLint)
GLuint m_drawMode
Definition openglosd.h:322
cVideoRender - Video render class
#define OGL_MAX_OSDIMAGES
Definition openglosd.h:639
#define BORDERCOLOR
const char * message
Definition openglosd.h:40
#define MIN_CHARCODE
Definition openglosd.h:175
const struct @0 FT_Errors[]
int code
Definition openglosd.h:39
eShaderType
Definition openglosd.h:68
@ stText
Definition openglosd.h:72
@ stCount
Definition openglosd.h:73
@ stTextureSwapBR
Definition openglosd.h:71
@ stRect
Definition openglosd.h:69
@ stTexture
Definition openglosd.h:70
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:176
tKerning(FT_ULong prevSym, GLfloat kerning=0.0f)
Definition openglosd.h:122