diff options
author | Sam Lantinga <slouken@libsdl.org> | 2014-08-18 11:28:16 -0700 |
---|---|---|
committer | Sam Lantinga <slouken@libsdl.org> | 2014-08-18 11:28:16 -0700 |
commit | 725969c534e4eed1c617a833f6c3428b7cb46bed (patch) | |
tree | 63c3a05b4703b9c874323cf807bf1af16253e7ad /src/render/opengl | |
parent | 6bf70fbd5c70784079a0d41cfea859cd44173e4b (diff) | |
download | sdl-725969c534e4eed1c617a833f6c3428b7cb46bed.tar.gz |
Fixed UV texture coordinate scale when using GL_ARB_texture_non_power_of_two
Diffstat (limited to 'src/render/opengl')
-rw-r--r-- | src/render/opengl/SDL_shaders_gl.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/render/opengl/SDL_shaders_gl.c b/src/render/opengl/SDL_shaders_gl.c index d8f60d4a0..a831890ca 100644 --- a/src/render/opengl/SDL_shaders_gl.c +++ b/src/render/opengl/SDL_shaders_gl.c @@ -150,7 +150,7 @@ static const char *shader_source[NUM_SHADERS][2] = " yuv.x = texture2D(tex0, tcoord).r;\n" "\n" " // Get the U and V values \n" -" tcoord *= 0.5;\n" +" tcoord *= UVCoordScale;\n" " yuv.y = texture2D(tex1, tcoord).r;\n" " yuv.z = texture2D(tex2, tcoord).r;\n" "\n" @@ -201,7 +201,7 @@ static const char *shader_source[NUM_SHADERS][2] = " yuv.x = texture2D(tex0, tcoord).r;\n" "\n" " // Get the U and V values \n" -" tcoord *= 0.5;\n" +" tcoord *= UVCoordScale;\n" " yuv.yz = texture2D(tex1, tcoord).ra;\n" "\n" " // Do the color transform \n" @@ -251,7 +251,7 @@ static const char *shader_source[NUM_SHADERS][2] = " yuv.x = texture2D(tex0, tcoord).r;\n" "\n" " // Get the U and V values \n" -" tcoord *= 0.5;\n" +" tcoord *= UVCoordScale;\n" " yuv.yz = texture2D(tex1, tcoord).ar;\n" "\n" " // Do the color transform \n" @@ -318,7 +318,11 @@ CompileShaderProgram(GL_ShaderContext *ctx, int index, GL_ShaderData *data) if (ctx->GL_ARB_texture_rectangle_supported) { frag_defines = "#define sampler2D sampler2DRect\n" -"#define texture2D texture2DRect\n"; +"#define texture2D texture2DRect\n" +"#define UVCoordScale 0.5\n"; + } else { + frag_defines = +"#define UVCoordScale 1.0\n"; } /* Create one program object to rule them all */ |