summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-07-01 10:58:32 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-07-01 10:58:32 +0000
commit0da07e37242883585bee1f9cfb51409286970ccb (patch)
treedbcfa05fd4ba2f95f9134192529b10573e810619 /libvo
parentf86db2816c2a270a54da972002b55bdbdc747b70 (diff)
downloadmpv-0da07e37242883585bee1f9cfb51409286970ccb.tar.bz2
mpv-0da07e37242883585bee1f9cfb51409286970ccb.tar.xz
Make sure all texture units have a different texture bound.
Should fix weird behaviour with e.g. yuv=4:lscale=1 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18876 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_gl.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index d1803379f4..2edab2515f 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -80,7 +80,7 @@ static GLenum gl_type;
static GLuint gl_buffer;
static int gl_buffersize;
static GLuint fragprog;
-static GLuint uvtexs[2];
+static GLuint default_texs[8];
static char *custom_prog;
static char *custom_tex;
static int custom_tlin;
@@ -224,12 +224,15 @@ static void clearOSD(void) {
* \brief uninitialize OpenGL context, freeing textures, buffers etc.
*/
static void uninitGl(void) {
+ int i = 0;
if (DeletePrograms && fragprog)
DeletePrograms(1, &fragprog);
fragprog = 0;
- if (uvtexs[0] || uvtexs[1])
- glDeleteTextures(2, uvtexs);
- uvtexs[0] = uvtexs[1] = 0;
+ while (default_texs[i] != 0)
+ i++;
+ if (i)
+ glDeleteTextures(i, default_texs);
+ default_texs[0] = 0;
clearOSD();
if (DeleteBuffers && gl_buffer)
DeleteBuffers(1, &gl_buffer);
@@ -243,7 +246,7 @@ static void uninitGl(void) {
*/
static int initGl(uint32_t d_width, uint32_t d_height) {
osdtexCnt = 0; gl_buffer = 0; gl_buffersize = 0; err_shown = 0;
- fragprog = 0; uvtexs[0] = 0; uvtexs[1] = 0;
+ fragprog = 0;
texSize(image_width, image_height, &texture_width, &texture_height);
glDisable(GL_BLEND);
@@ -258,13 +261,19 @@ static int initGl(uint32_t d_width, uint32_t d_height) {
texture_width, texture_height);
if (image_format == IMGFMT_YV12) {
- glGenTextures(2, uvtexs);
+ int i;
+ glGenTextures(7, default_texs);
+ default_texs[7] = 0;
+ for (i = 0; i < 7; i++) {
+ ActiveTexture(GL_TEXTURE1 + i);
+ BindTexture(GL_TEXTURE_2D, default_texs[i]);
+ BindTexture(GL_TEXTURE_RECTANGLE, default_texs[i]);
+ BindTexture(GL_TEXTURE_3D, default_texs[i]);
+ }
ActiveTexture(GL_TEXTURE1);
- BindTexture(gl_target, uvtexs[0]);
glCreateClearTex(gl_target, gl_texfmt, GL_LINEAR,
texture_width / 2, texture_height / 2, 128);
ActiveTexture(GL_TEXTURE2);
- BindTexture(gl_target, uvtexs[1]);
glCreateClearTex(gl_target, gl_texfmt, GL_LINEAR,
texture_width / 2, texture_height / 2, 128);
switch (use_yuv) {