By allowing a palette to be copied to an array, a speedup can be gained in HardwarePalette since palettes can be block copied using native magic rather than having to copy them item by item. We transpose the buffer in HardwarePalette in order to allow a contiguous block copy into this buffer, transposing again in the shader to keep everything correct.
9 lines
213 B
GLSL
9 lines
213 B
GLSL
uniform sampler2D DiffuseTexture, Palette;
|
|
|
|
void main()
|
|
{
|
|
vec4 x = texture2D(DiffuseTexture, gl_TexCoord[0].st);
|
|
vec2 p = vec2(dot(x, gl_TexCoord[1]), gl_TexCoord[0].p);
|
|
gl_FragColor = texture2D(Palette, p);
|
|
}
|