vlc | branch: master | Martin Storsjö <[email protected]> | Thu Mar 14 12:20:37 2013 +0200| [d2495a02b0f47cf40970f8cdf170161ce82d5a3a] | committer: Martin Storsjö
opengl: Handle subpicture textures being aligned to power-of-two dimensions This fixes subpicture textures on ES1. Signed-off-by: Martin Storsjö <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d2495a02b0f47cf40970f8cdf170161ce82d5a3a --- modules/video_output/opengl.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c index d27d682..a46fcc6 100644 --- a/modules/video_output/opengl.c +++ b/modules/video_output/opengl.c @@ -105,6 +105,9 @@ typedef struct { float left; float bottom; float right; + + float tex_width; + float tex_height; } gl_region_t; struct vout_display_opengl_t { @@ -811,6 +814,11 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl, if (!vgl->supports_npot) { glr->width = GetAlignedSize(glr->width); glr->height = GetAlignedSize(glr->height); + glr->tex_width = (float) r->fmt.i_visible_width / glr->width; + glr->tex_height = (float) r->fmt.i_visible_height / glr->height; + } else { + glr->tex_width = 1.0; + glr->tex_height = 1.0; } glr->alpha = (float)subpicture->i_alpha * r->i_alpha / 255 / 255; glr->left = 2.0 * (r->i_x ) / subpicture->i_original_picture_width - 1.0; @@ -1017,11 +1025,11 @@ int vout_display_opengl_Display(vout_display_opengl_t *vgl, glr->right, glr->top, glr->right, glr->bottom, }; - static const GLfloat textureCoord[] = { + const GLfloat textureCoord[] = { 0.0, 0.0, - 0.0, 1.0, - 1.0, 0.0, - 1.0, 1.0, + 0.0, glr->tex_height, + glr->tex_width, 0.0, + glr->tex_width, glr->tex_height, }; glBindTexture(GL_TEXTURE_2D, glr->texture); _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
