summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/opengl/shader/glsl_plain_rgb32_lut.fsh.c
blob: 9c9be21b35bdafbf5323d20b1caad9cbb3c19068 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// license:BSD-3-Clause
// copyright-holders:Sven Gothel
const char glsl_plain_rgb32_lut_fsh_src[] =
"\n"
"#pragma optimize (on)\n"
"#pragma debug (off)\n"
"\n"
"uniform sampler2D color_texture;\n"
"uniform sampler2D colortable_texture;\n"
"uniform vec2      colortable_sz;         // orig size for full bgr\n"
"uniform vec2      colortable_pow2_sz;    // orig size for full bgr\n"
"\n"
"void main()\n"
"{\n"
"   vec4 color_tex;\n"
"   vec2 color_map_coord;\n"
"   float colortable_scale = (colortable_sz.x/3.0) / colortable_pow2_sz.x;\n"
"\n"
"   // normalized texture coordinates ..\n"
"   color_tex = texture2D(color_texture, gl_TexCoord[0].st) * ((colortable_sz.x/3.0)-1.0)/colortable_pow2_sz.x;// lookup space \n"
"\n"
"   color_map_coord.x = color_tex.b;\n"
"   gl_FragColor.b    = texture2D(colortable_texture, color_map_coord).b;\n"
"\n"
"   color_map_coord.x = color_tex.g + colortable_scale;\n"
"   gl_FragColor.g    = texture2D(colortable_texture, color_map_coord).g;\n"
"\n"
"   color_map_coord.x = color_tex.r + 2.0 * colortable_scale;\n"
"   gl_FragColor.r    = texture2D(colortable_texture, color_map_coord).r;\n"
"}\n"
"\n"
;