summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-06-15 08:43:41 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-06-15 08:43:41 +0000
commit580302e179f920b9408b9a7c96e5d6e1f12b5d93 (patch)
tree28a4c8c93a38c473188c63667c21ed3fdd01b7e3 /libvo
parentf3f1509ba9f413aef8152ec53f91ad4d4437c0b7 (diff)
downloadmpv-580302e179f920b9408b9a7c96e5d6e1f12b5d93.tar.bz2
mpv-580302e179f920b9408b9a7c96e5d6e1f12b5d93.tar.xz
Reduce number of OpenGL state changes when drawing OSD by first drawing alpha.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18722 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_gl.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index ab2cff9c08..c57be46739 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -53,6 +53,9 @@ static GLuint osdatex[MAX_OSD_PARTS];
#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 @@ static void clearOSD(void) {
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 @@ static void create_osd_texture(int x0, int y0, int w, int h,
BindTexture(gl_target, 0);
// Create a list for rendering this OSD part
- osdDispList[osdtexCnt] = glGenLists(1);
- glNewList(osdDispList[osdtexCnt], GL_COMPILE);
#ifndef FAST_OSD
+ osdaDispList[osdtexCnt] = glGenLists(1);
+ glNewList(osdaDispList[osdtexCnt], GL_COMPILE);
// 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);
+ glEndList();
#endif
+ osdDispList[osdtexCnt] = glGenLists(1);
+ glNewList(osdDispList[osdtexCnt], GL_COMPILE);
// 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 @@ flip_page(void)
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);