Mercurial > mplayer.hg
changeset 18719:5d01eb066fa3
Reduce number of OpenGL state changes when drawing OSD by first drawing alpha.
author | reimar |
---|---|
date | Thu, 15 Jun 2006 08:43:41 +0000 |
parents | 7ef29a590f3f |
children | 4bad7f00556e |
files | libvo/vo_gl.c |
diffstat | 1 files changed, 18 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/vo_gl.c Thu Jun 15 08:09:03 2006 +0000 +++ b/libvo/vo_gl.c Thu Jun 15 08:43:41 2006 +0000 @@ -53,6 +53,9 @@ #endif //! Display lists that draw the OSD parts static GLuint osdDispList[MAX_OSD_PARTS]; +#ifndef FAST_OSD +static GLuint osdaDispList[MAX_OSD_PARTS]; +#endif //! How many parts the OSD currently consists of static int osdtexCnt; static int osd_color; @@ -210,6 +213,8 @@ glDeleteTextures(osdtexCnt, osdtex); #ifndef FAST_OSD glDeleteTextures(osdtexCnt, osdatex); + for (i = 0; i < osdtexCnt; i++) + glDeleteLists(osdaDispList[i], 1); #endif for (i = 0; i < osdtexCnt; i++) glDeleteLists(osdDispList[i], 1); @@ -473,16 +478,17 @@ BindTexture(gl_target, 0); // Create a list for rendering this OSD part +#ifndef FAST_OSD + osdaDispList[osdtexCnt] = glGenLists(1); + glNewList(osdaDispList[osdtexCnt], GL_COMPILE); + // render alpha + BindTexture(gl_target, osdatex[osdtexCnt]); + glDrawTex(x0, y0, w, h, 0, 0, w, h, sx, sy, use_rectangle == 1, 0, 0); + glEndList(); +#endif osdDispList[osdtexCnt] = glGenLists(1); glNewList(osdDispList[osdtexCnt], GL_COMPILE); -#ifndef FAST_OSD - // render alpha - glBlendFunc(GL_ZERO, GL_SRC_ALPHA); - BindTexture(gl_target, osdatex[osdtexCnt]); - glDrawTex(x0, y0, w, h, 0, 0, w, h, sx, sy, use_rectangle == 1, 0, 0); -#endif // render OSD - glBlendFunc (GL_ONE, GL_ONE); BindTexture(gl_target, osdtex[osdtexCnt]); glDrawTex(x0, y0, w, h, 0, 0, w, h, sx, sy, use_rectangle == 1, 0, 0); glEndList(); @@ -529,6 +535,11 @@ glEnable(GL_BLEND); glColor4ub((osd_color >> 16) & 0xff, (osd_color >> 8) & 0xff, osd_color & 0xff, 0xff); // draw OSD +#ifndef FAST_OSD + glBlendFunc(GL_ZERO, GL_SRC_ALPHA); + glCallLists(osdtexCnt, GL_UNSIGNED_INT, osdaDispList); +#endif + glBlendFunc(GL_ONE, GL_ONE); glCallLists(osdtexCnt, GL_UNSIGNED_INT, osdDispList); // set rendering parameters back to defaults glDisable (GL_BLEND);