[MPlayer-dev-eng] Re: [PATCH] OSD tinting for vo_gl

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Mar 25 21:57:25 CET 2006


Hi,
On Sat, Mar 25, 2006 at 09:27:20PM +0100, Tomas Janousek wrote:
> Reimar Döffinger napsal(a):
> >Does OpenGL define "default" states? Because this will only work when
> >TEXTURE_ENV_MODE is MODULATE.
> >If you don't know what I'm talking about, don't worry, I'll have a look
> >at it when I have time (though it will be faster if you fix it *g*).
> 
> This[1] page says MODULATE is the default, but I can set it. I really do 
> not know, which way is better, so I send the new patch and hope someone 
> will know, which one is right.
> 
> [1] 
> http://www.opengl.org/documentation/specs/version1.1/glspec1.1/node88.html

Ok. Though I'm a fan of making it explicit anyway. Though you are doing
it in a place where it is called much more often the necessary (esp. for
the glColor thing there IMHO is no reason to be added to every display
list).
Please try if the attached patch works as well.

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libvo/vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.116
diff -u -r1.116 vo_gl.c
--- libvo/vo_gl.c	15 Mar 2006 21:13:13 -0000	1.116
+++ libvo/vo_gl.c	25 Mar 2006 20:53:56 -0000
@@ -55,6 +55,8 @@
 static GLuint osdDispList[MAX_OSD_PARTS];
 //! How many parts the OSD currently consists of
 static int osdtexCnt;
+//! OSD color
+static int osd_color;
 
 static int use_aspect;
 static int use_yuv;
@@ -251,6 +254,7 @@
   glDisable(GL_CULL_FACE);
   glEnable(gl_target);
   glDrawBuffer(vo_doublebuffering?GL_BACK:GL_FRONT);
+  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
 
   mp_msg(MSGT_VO, MSGL_V, "[gl] Creating %dx%d texture...\n",
           texture_width, texture_height);
@@ -529,6 +534,7 @@
     glOrtho(0, vo_dwidth, vo_dheight, 0, -1, 1);
     }
     glEnable(GL_BLEND);
+    glColor4ub((osd_color >> 16) & 0xff, (osd_color >> 8) & 0xff, osd_color & 0xff, 0xff);
     // draw OSD
     glCallLists(osdtexCnt, GL_UNSIGNED_INT, osdDispList);
     // set rendering parameters back to defaults
@@ -690,6 +702,7 @@
   {"customprog",   OPT_ARG_MSTRZ,&custom_prog,  NULL},
   {"customtex",    OPT_ARG_MSTRZ,&custom_tex,   NULL},
   {"customtlin",   OPT_ARG_BOOL, &custom_tlin,  NULL},
+  {"osdcolor",     OPT_ARG_INT,  &osd_color,    NULL},
   {NULL}
 };
 
@@ -708,6 +721,7 @@
     custom_prog = NULL;
     custom_tex = NULL;
     custom_tlin = 1;
+    osd_color = 0xffffff;
     if (subopt_parse(arg, subopts) != 0) {
       mp_msg(MSGT_VO, MSGL_FATAL,
               "\n-vo gl command line help:\n"
@@ -744,6 +758,8 @@
               "    use a custom YUV conversion lookup texture\n"
               "  nocustomtlin\n"
               "    use GL_NEAREST scaling for customtex texture\n"
+              "  osdcolor=<0xRRGGBB>\n"
+              "    Tint the OSD with the given color\n"
               "\n" );
       return -1;
     }


More information about the MPlayer-dev-eng mailing list