comparison OrthancStone/Sources/Scene2D/Internals/OpenGLFloatTextureProgram.cpp @ 1969:ee68ee732aa7

fix OpenGL shader for floating-point textures
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 28 Oct 2022 13:20:36 +0200
parents 7053b8a0aaec
children 07964689cb0b
comparison
equal deleted inserted replaced
1968:ed5a0b9183dc 1969:ee68ee732aa7
39 "uniform sampler2D u_texture; \n" 39 "uniform sampler2D u_texture; \n"
40 "varying vec2 v_texcoord; \n" 40 "varying vec2 v_texcoord; \n"
41 "void main() \n" 41 "void main() \n"
42 "{ \n" 42 "{ \n"
43 " vec4 t = texture2D(u_texture, v_texcoord); \n" 43 " vec4 t = texture2D(u_texture, v_texcoord); \n"
44 " float v = (t.r * 256.0 + t.g) * 256.0; \n" 44 " float v = (t.r * 256.0 + t.g) * 255.0; \n"
45 " v = v * u_slope + u_offset; \n" // (*) 45 " v = v * u_slope + u_offset; \n" // (*)
46 " float a = u_windowCenter - u_windowWidth / 2.0; \n" 46 " float a = u_windowCenter - u_windowWidth / 2.0; \n"
47 " float dy = 1.0 / u_windowWidth; \n" 47 " float dy = 1.0 / u_windowWidth; \n"
48 " if (v <= a) \n" 48 " if (v <= a) \n"
49 " v = 0.0; \n" 49 " v = 0.0; \n"