summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-12-19 20:53:34 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-12-19 20:53:34 +0000
commit300d40bed3c9e3b443c18c5c7ef95d067c690d2e (patch)
tree26e7ee91eb5f61c8be711b51b5154e7a993a2d43
parent5dc258f4e8d31ba0989a811be0d82511026938d3 (diff)
downloadmpv-300d40bed3c9e3b443c18c5c7ef95d067c690d2e.tar.bz2
mpv-300d40bed3c9e3b443c18c5c7ef95d067c690d2e.tar.xz
Add support for auto-generating mipmaps in vo_gl, should ease
implementing anything that needs blur filters with large support. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30072 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libvo/vo_gl.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index b85b637be1..95b182912e 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -127,6 +127,7 @@ static char *custom_prog;
static char *custom_tex;
static int custom_tlin;
static int custom_trect;
+static int mipmap_gen;
static int int_pause;
static int eq_bri = 0;
@@ -465,6 +466,7 @@ static void autodetectGlExtensions(void) {
* set global gl-related variables to their default values
*/
static int initGl(uint32_t d_width, uint32_t d_height) {
+ int scale_type = mipmap_gen ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR;
autodetectGlExtensions();
texSize(image_width, image_height, &texture_width, &texture_height);
@@ -490,11 +492,15 @@ static int initGl(uint32_t d_width, uint32_t d_height) {
BindTexture(GL_TEXTURE_3D, default_texs[i + 14]);
}
ActiveTexture(GL_TEXTURE1);
- glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR,
+ glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type,
texture_width / 2, texture_height / 2, 128);
+ if (mipmap_gen)
+ TexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE);
ActiveTexture(GL_TEXTURE2);
- glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR,
+ glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type,
texture_width / 2, texture_height / 2, 128);
+ if (mipmap_gen)
+ TexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE);
ActiveTexture(GL_TEXTURE0);
BindTexture(gl_target, 0);
}
@@ -510,8 +516,10 @@ static int initGl(uint32_t d_width, uint32_t d_height) {
}
update_yuvconv();
}
- glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR,
+ glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type,
texture_width, texture_height, 0);
+ if (mipmap_gen)
+ TexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE);
resize(d_width, d_height);
@@ -996,6 +1004,7 @@ static const opt_t subopts[] = {
{"customtex", OPT_ARG_MSTRZ,&custom_tex, NULL},
{"customtlin", OPT_ARG_BOOL, &custom_tlin, NULL},
{"customtrect", OPT_ARG_BOOL, &custom_trect, NULL},
+ {"mipmapgen", OPT_ARG_BOOL, &mipmap_gen, NULL},
{"osdcolor", OPT_ARG_INT, &osd_color, NULL},
{NULL}
};
@@ -1027,6 +1036,7 @@ static int preinit(const char *arg)
custom_tex = NULL;
custom_tlin = 1;
custom_trect = 0;
+ mipmap_gen = 0;
osd_color = 0xffffff;
if (subopt_parse(arg, subopts) != 0) {
mp_msg(MSGT_VO, MSGL_FATAL,
@@ -1084,6 +1094,8 @@ static int preinit(const char *arg)
" use GL_NEAREST scaling for customtex texture\n"
" customtrect\n"
" use texture_rectangle for customtex texture\n"
+ " mipmapgen\n"
+ " generate mipmaps for the video image (use with TXB in customprog)\n"
" osdcolor=<0xAARRGGBB>\n"
" use the given color for the OSD\n"
" ycbcr\n"