Fixed UV texture coordinate scale when using GL_ARB_texture_non_power_of_two
authorSam Lantinga <slouken@libsdl.org>
Mon, 18 Aug 2014 11:28:16 -0700
changeset 9089a592d934b331
parent 9088 c94127dcbe97
child 9090 29eb1cfa3445
Fixed UV texture coordinate scale when using GL_ARB_texture_non_power_of_two
src/render/opengl/SDL_shaders_gl.c
     1.1 --- a/src/render/opengl/SDL_shaders_gl.c	Mon Aug 18 14:05:02 2014 -0400
     1.2 +++ b/src/render/opengl/SDL_shaders_gl.c	Mon Aug 18 11:28:16 2014 -0700
     1.3 @@ -150,7 +150,7 @@
     1.4  "    yuv.x = texture2D(tex0, tcoord).r;\n"
     1.5  "\n"
     1.6  "    // Get the U and V values \n"
     1.7 -"    tcoord *= 0.5;\n"
     1.8 +"    tcoord *= UVCoordScale;\n"
     1.9  "    yuv.y = texture2D(tex1, tcoord).r;\n"
    1.10  "    yuv.z = texture2D(tex2, tcoord).r;\n"
    1.11  "\n"
    1.12 @@ -201,7 +201,7 @@
    1.13  "    yuv.x = texture2D(tex0, tcoord).r;\n"
    1.14  "\n"
    1.15  "    // Get the U and V values \n"
    1.16 -"    tcoord *= 0.5;\n"
    1.17 +"    tcoord *= UVCoordScale;\n"
    1.18  "    yuv.yz = texture2D(tex1, tcoord).ra;\n"
    1.19  "\n"
    1.20  "    // Do the color transform \n"
    1.21 @@ -251,7 +251,7 @@
    1.22  "    yuv.x = texture2D(tex0, tcoord).r;\n"
    1.23  "\n"
    1.24  "    // Get the U and V values \n"
    1.25 -"    tcoord *= 0.5;\n"
    1.26 +"    tcoord *= UVCoordScale;\n"
    1.27  "    yuv.yz = texture2D(tex1, tcoord).ar;\n"
    1.28  "\n"
    1.29  "    // Do the color transform \n"
    1.30 @@ -318,7 +318,11 @@
    1.31      if (ctx->GL_ARB_texture_rectangle_supported) {
    1.32          frag_defines =
    1.33  "#define sampler2D sampler2DRect\n"
    1.34 -"#define texture2D texture2DRect\n";
    1.35 +"#define texture2D texture2DRect\n"
    1.36 +"#define UVCoordScale 0.5\n";
    1.37 +    } else {
    1.38 +        frag_defines = 
    1.39 +"#define UVCoordScale 1.0\n";
    1.40      }
    1.41  
    1.42      /* Create one program object to rule them all */