Mercurial > sdl-ios-xcode
comparison src/video/SDL_renderer_gl.c @ 3707:d8308bc267bc
Adam Strzelecki to SDL
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
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 17 Feb 2010 04:42:52 +0000 |
parents | f7b03b6838cb |
children | 6cf71111cf68 |
comparison
equal
deleted
inserted
replaced
3706:9676307d93be | 3707:d8308bc267bc |
---|---|
827 data->texh = (GLfloat) texture->h / texture_h; | 827 data->texh = (GLfloat) texture->h / texture_h; |
828 } | 828 } |
829 | 829 |
830 /* YUV formats use RGBA but are really two bytes per pixel */ | 830 /* YUV formats use RGBA but are really two bytes per pixel */ |
831 if (internalFormat == GL_RGBA && bytes_per_pixel(texture->format) < 4) { | 831 if (internalFormat == GL_RGBA && bytes_per_pixel(texture->format) < 4) { |
832 texture_w /= 2; | |
833 if (data->type == GL_TEXTURE_2D) { | |
834 data->texw *= 2.0f; | |
835 } | |
832 data->HACK_RYAN_FIXME = 2; | 836 data->HACK_RYAN_FIXME = 2; |
833 } else { | 837 } else { |
834 data->HACK_RYAN_FIXME = 1; | 838 data->HACK_RYAN_FIXME = 1; |
835 } | 839 } |
836 texture_w /= data->HACK_RYAN_FIXME; | |
837 | 840 |
838 data->format = format; | 841 data->format = format; |
839 data->formattype = type; | 842 data->formattype = type; |
840 renderdata->glEnable(data->type); | 843 renderdata->glEnable(data->type); |
841 renderdata->glBindTexture(data->type, data->texture); | 844 renderdata->glBindTexture(data->type, data->texture); |