From 84ec21ea236f4052ea7a6a3b8f5fd8029ea3846b Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 17 Dec 2014 21:36:17 +0100 Subject: vo_opengl: cleanup dither texture creation Might be slightly more compatible too, and will make it work on GLES. --- video/out/gl_video.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/video/out/gl_video.c b/video/out/gl_video.c index c7b05a9551..8a5940e428 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -1262,9 +1262,9 @@ static void init_dither(struct gl_video *p) int tex_size; void *tex_data; GLint tex_iformat; + GLint tex_format; GLenum tex_type; unsigned char temp[256]; - GLint tex_format = find_tex_format(gl, 1, 1)->format; if (p->opts.dither_algo == 0) { int sizeb = p->opts.dither_size; @@ -1278,16 +1278,19 @@ static void init_dither(struct gl_video *p) } tex_size = size; - tex_iformat = find_tex_format(gl, 2, 1)->internal_format; + tex_iformat = gl_float16_formats[0].internal_format; + tex_format = gl_float16_formats[0].format; tex_type = GL_FLOAT; tex_data = p->last_dither_matrix; } else { assert(sizeof(temp) >= 8 * 8); mp_make_ordered_dither_matrix(temp, 8); + const struct fmt_entry *fmt = find_tex_format(gl, 1, 1); tex_size = 8; - tex_iformat = tex_format; - tex_type = GL_UNSIGNED_BYTE; + tex_iformat = fmt->internal_format; + tex_format = fmt->format; + tex_type = fmt->type; tex_data = temp; } @@ -1311,6 +1314,8 @@ static void init_dither(struct gl_video *p) gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); gl->ActiveTexture(GL_TEXTURE0); + + debug_check_gl(p, "dither setup"); } static void recreate_osd(struct gl_video *p) -- cgit v1.2.3