diff -r 38e89ab78465 src/render/opengl/SDL_render_gl.c --- a/src/render/opengl/SDL_render_gl.c Wed Jun 25 02:08:37 2014 -0700 +++ b/src/render/opengl/SDL_render_gl.c Wed Jun 25 19:19:48 2014 +0200 @@ -824,7 +824,7 @@ renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, (pitch / 2)); /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); + pixels = (const void*)((const Uint8*)pixels + texture->h * pitch); if (texture->format == SDL_PIXELFORMAT_YV12) { renderdata->glBindTexture(data->type, data->vtexture); } else { @@ -835,7 +835,7 @@ data->format, data->formattype, pixels); /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4); + pixels = (const void*)((const Uint8*)pixels + (texture->h * pitch)/4); if (texture->format == SDL_PIXELFORMAT_YV12) { renderdata->glBindTexture(data->type, data->utexture); } else { diff -r 38e89ab78465 src/render/opengles2/SDL_render_gles2.c --- a/src/render/opengles2/SDL_render_gles2.c Wed Jun 25 02:08:37 2014 -0700 +++ b/src/render/opengles2/SDL_render_gles2.c Wed Jun 25 19:19:48 2014 +0200 @@ -641,12 +641,13 @@ if (tdata->yuv) { /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); + pixels = (const void*)((const Uint8*)pixels + texture->h * pitch); if (texture->format == SDL_PIXELFORMAT_YV12) { data->glBindTexture(tdata->texture_type, tdata->texture_v); } else { data->glBindTexture(tdata->texture_type, tdata->texture_u); } + GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, @@ -657,7 +658,7 @@ pixels, pitch / 2, 1); /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4); + pixels = (const void*)((const Uint8*)pixels + (texture->h * pitch)/4); if (texture->format == SDL_PIXELFORMAT_YV12) { data->glBindTexture(tdata->texture_type, tdata->texture_u); } else { @@ -694,8 +695,8 @@ data->glBindTexture(tdata->texture_type, tdata->texture_v); GLES2_TexSubImage2D(data, tdata->texture_type, - rect->x, - rect->y, + rect->x / 2, + rect->y / 2, rect->w / 2, rect->h / 2, tdata->pixel_format, @@ -704,8 +705,8 @@ data->glBindTexture(tdata->texture_type, tdata->texture_u); GLES2_TexSubImage2D(data, tdata->texture_type, - rect->x, - rect->y, + rect->x / 2, + rect->y / 2, rect->w / 2, rect->h / 2, tdata->pixel_format,