Updated after many stupid questions
Objective: To apply the texture palette means GL-shaders (emulate Indexed8 texture format). Internet is full of articles on a subject, and all contained the same solution. I have it, unfortunately, it don't work for me.
So.
The fragment shader:
uniform sampler2D texture;
uniform sampler2D palette;
uniform int paletteIndex;
layout (origin_upper_left) in vec4 gl_FragCoord;
void main()
{
int colorIndex = int(texture2D(texture, gl_TexCoord[0].xy, 0).r * 255);
gl_FragColor = texelFetch(palette, ivec2(colorIndex, paletteIndex), 0);
}
Vertex shader:
void main () {
gl_Position = ftransform ();
gl_TexCoord [0] = gl_MultiTexCoord0;
}
This is my result (left - my picture, right - original):
Damn, I just set incorrect vertex coords! >.<
Thanks for good man who tried to help. Now I know that different from texture2d and fetchTexel and found reason of issue! D: