const char glsl_idx16_lut_cgauss_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;      // ct size\n"
"uniform vec2      colortable_pow2_sz; // pow2 ct size\n"
"\n"
"#define KERNEL_SIZE 9\n"
"const int MaxKernelSize = KERNEL_SIZE;\n"
"\n"
"uniform vec2 Offset[MaxKernelSize];\n"
"\n"
"uniform vec4 KernelValue[MaxKernelSize];\n"
"\n"
"vec4 lutTex2D(in vec2 texcoord)\n"
"{\n"
"	vec4 color_tex;\n"
"	vec2 color_map_coord;\n"
"\n"
"	// normalized texture coordinates ..\n"
"	color_tex = texture2D(color_texture, texcoord);\n"
"\n"
"	// GL_UNSIGNED_SHORT GL_ALPHA in ALPHA16 conversion:\n"
"	// general: f = c / ((2*N)-1), c color bitfield, N number of bits\n"
"	// ushort:  c = ((2**16)-1)*f;\n"
"	color_map_coord.x  = 65536.0 * color_tex.a;\n"
"\n"
"	// map it to the 2D lut table\n"
"	color_map_coord.y = floor(color_map_coord.x/colortable_sz.x);\n"
"	color_map_coord.x =   mod(color_map_coord.x,colortable_sz.x);\n"
"\n"
"	return texture2D(colortable_texture, color_map_coord/colortable_pow2_sz);\n"
"}\n"
"\n"
"void main()\n"
"{\n"
"	vec4 sum = vec4(0.0);\n"
"	int i;\n"
"\n"
"	// sum it up ..\n"
"	for(i=0; i<KERNEL_SIZE; i++)\n"
"	{\n"
"		sum += lutTex2D(gl_TexCoord[0].st + Offset[i]) * KernelValue[i];\n"
"	}\n"
"	\n"
"	gl_FragColor = sum;\n"
"}\n"
"\n"
;
