When graphic card has no GL_ARB_texture_rectangle YUV textures mapped with SDL_RenderCopy are stretched 2x horizontally, so only left half of texture is visible. This is due:
data->texw = (GLfloat) (texture->w) / texture_w;
data->texh = (GLfloat) texture->h / texture_h;
But afterwards texture_w /= 2 for YUV texture, but data->texw stays as it was before, while it should be multiplied 2x.
This bug can be seen in any program setting env variables: GL_APPLE_ycbcr_422=0 GL_EXT_texture_rectangle=0 GL_ARB_texture_rectangle=0
Here’s a patch:
Index: src/video/SDL_renderer_gl.c===================================================================
— src/video/SDL_renderer_gl.c (revision 5541)
+++ src/video/SDL_renderer_gl.c (working copy)
@@ -830,10 +830,13 @@
/* YUV formats use RGBA but are really two bytes per pixel */
if (internalFormat == GL_RGBA && bytes_per_pixel(texture->format) < 4) {
data->HACK_RYAN_FIXME = 2;
Thanks, this patch is in subversion! :)On Tue, Feb 9, 2010 at 5:11 AM, Adam Strzelecki wrote:
When graphic card has no GL_ARB_texture_rectangle YUV textures mapped with SDL_RenderCopy are stretched 2x horizontally, so only left half of texture is visible. This is due:
? ? ? ?data->texw = (GLfloat) (texture->w) / texture_w;
? ? ? ?data->texh = (GLfloat) texture->h / texture_h;
But afterwards texture_w /= 2 for YUV texture, but data->texw stays as it was before, while it should be multiplied 2x.
This bug can be seen in any program setting env variables: GL_APPLE_ycbcr_422=0 GL_EXT_texture_rectangle=0 GL_ARB_texture_rectangle=0
Here’s a patch:
Index: src/video/SDL_renderer_gl.c
— src/video/SDL_renderer_gl.c (revision 5541)
+++ src/video/SDL_renderer_gl.c (working copy)
@@ -830,10 +830,13 @@
? ? /* YUV formats use RGBA but are really two bytes per pixel */
? ? if (internalFormat == GL_RGBA && bytes_per_pixel(texture->format) < 4) {
? ? ? ? data->HACK_RYAN_FIXME = 2;