Commit 446263ea authored by Laurent Aimar's avatar Laurent Aimar

Fixed rendering of subpictures with non 0 offset in opengl.

It is needed for DVD menu support.
parent 4343ec78
...@@ -569,13 +569,15 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl, ...@@ -569,13 +569,15 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
} }
} }
const int pixels_offset = r->fmt.i_y_offset * r->p_picture->p->i_pitch +
r->fmt.i_x_offset * r->p_picture->p->i_pixel_pitch;
if (glr->texture) { if (glr->texture) {
glBindTexture(GL_TEXTURE_2D, glr->texture); glBindTexture(GL_TEXTURE_2D, glr->texture);
/* TODO set GL_UNPACK_ALIGNMENT */ /* TODO set GL_UNPACK_ALIGNMENT */
glPixelStorei(GL_UNPACK_ROW_LENGTH, r->p_picture->p->i_pitch / r->p_picture->p->i_pixel_pitch); glPixelStorei(GL_UNPACK_ROW_LENGTH, r->p_picture->p->i_pitch / r->p_picture->p->i_pixel_pitch);
glTexSubImage2D(GL_TEXTURE_2D, 0, glTexSubImage2D(GL_TEXTURE_2D, 0,
0, 0, glr->width, glr->height, 0, 0, glr->width, glr->height,
glr->format, glr->type, r->p_picture->p->p_pixels); glr->format, glr->type, &r->p_picture->p->p_pixels[pixels_offset]);
} else { } else {
glGenTextures(1, &glr->texture); glGenTextures(1, &glr->texture);
glBindTexture(GL_TEXTURE_2D, glr->texture); glBindTexture(GL_TEXTURE_2D, glr->texture);
...@@ -589,7 +591,7 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl, ...@@ -589,7 +591,7 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
glPixelStorei(GL_UNPACK_ROW_LENGTH, r->p_picture->p->i_pitch / r->p_picture->p->i_pixel_pitch); glPixelStorei(GL_UNPACK_ROW_LENGTH, r->p_picture->p->i_pitch / r->p_picture->p->i_pixel_pitch);
glTexImage2D(GL_TEXTURE_2D, 0, glr->format, glTexImage2D(GL_TEXTURE_2D, 0, glr->format,
glr->width, glr->height, 0, glr->format, glr->type, glr->width, glr->height, 0, glr->format, glr->type,
r->p_picture->p->p_pixels); &r->p_picture->p->p_pixels[pixels_offset]);
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment