raze-gles/wadsrc/static/engine/shaders/glsl/glsurface.fp
alexey.lysiuk 2f4078d99e - fixed rendering on macOS
This restores support for OpenGL implementations without persistent mapped buffers, and helps with strict core profile GLSL compilers
2020-01-26 17:03:02 +01:00

21 lines
467 B
GLSL

#version 330
//s_texture points to an indexed color texture
uniform sampler2D s_texture;
//s_palette is the palette texture
uniform sampler2D s_palette;
in vec2 v_texCoord;
out vec4 FragColor;
const float c_paletteScale = 255.0/256.0;
const float c_paletteOffset = 0.5/256.0;
void main()
{
vec4 color = texture(s_texture, v_texCoord.xy);
color.r = c_paletteOffset + c_paletteScale*color.r;
color.rgb = texture(s_palette, color.rg).rgb;
FragColor = color;
}