# HG changeset patch # User Sebastien Jodogne # Date 1558688681 -7200 # Node ID ed783cbc92d7eccc7c4d34c6ccb7dbe50ad00072 # Parent e6850c8664699ea8af11770f39efca81320633e8 fix diff -r e6850c866469 -r ed783cbc92d7 Framework/Scene2D/Internals/CairoFloatTextureRenderer.cpp --- a/Framework/Scene2D/Internals/CairoFloatTextureRenderer.cpp Fri May 24 11:02:20 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoFloatTextureRenderer.cpp Fri May 24 11:04:41 2019 +0200 @@ -38,7 +38,7 @@ float windowCenter, windowWidth; l.GetWindowing(windowCenter, windowWidth); - const float a = windowCenter - windowWidth; + const float a = windowCenter - windowWidth / 2.0f; const float slope = 256.0f / windowWidth; const Orthanc::ImageAccessor& source = l.GetTexture(); diff -r e6850c866469 -r ed783cbc92d7 Framework/Scene2D/Internals/OpenGLFloatTextureProgram.cpp --- a/Framework/Scene2D/Internals/OpenGLFloatTextureProgram.cpp Fri May 24 11:02:20 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLFloatTextureProgram.cpp Fri May 24 11:04:41 2019 +0200 @@ -29,28 +29,28 @@ static const char* FRAGMENT_SHADER = ORTHANC_STONE_OPENGL_SHADER_VERSION_DIRECTIVE - "uniform float u_offset; \n" - "uniform float u_slope; \n" - "uniform float u_windowCenter; \n" - "uniform float u_windowWidth; \n" - "uniform sampler2D u_texture; \n" - "varying vec2 v_texcoord; \n" - "void main() \n" - "{ \n" - " vec4 t = texture2D(u_texture, v_texcoord); \n" - " float v = (t.r * 256.0 + t.g) * 256.0; \n" - " v = v * u_slope + u_offset; \n" // (*) - " float a = u_windowCenter - u_windowWidth; \n" - " float dy = 1.0 / u_windowWidth; \n" - " if (v <= a) \n" - " v = 0.0; \n" - " else \n" - " { \n" - " v = (v - a) * dy; \n" - " if (v >= 1.0) \n" - " v = 1.0; \n" - " } \n" - " gl_FragColor = vec4(v, v, v, 1); \n" + "uniform float u_offset; \n" + "uniform float u_slope; \n" + "uniform float u_windowCenter; \n" + "uniform float u_windowWidth; \n" + "uniform sampler2D u_texture; \n" + "varying vec2 v_texcoord; \n" + "void main() \n" + "{ \n" + " vec4 t = texture2D(u_texture, v_texcoord); \n" + " float v = (t.r * 256.0 + t.g) * 256.0; \n" + " v = v * u_slope + u_offset; \n" // (*) + " float a = u_windowCenter - u_windowWidth / 2.0; \n" + " float dy = 1.0 / u_windowWidth; \n" + " if (v <= a) \n" + " v = 0.0; \n" + " else \n" + " { \n" + " v = (v - a) * dy; \n" + " if (v >= 1.0) \n" + " v = 1.0; \n" + " } \n" + " gl_FragColor = vec4(v, v, v, 1); \n" "}";