2
\$\begingroup\$

How can I change the color of the application surface using a texture?

https://en.wikipedia.org/wiki/List_of_8-bit_computer_hardware_palettes

https://en.wikipedia.org/wiki/List_of_8-bit_computer_hardware_palettes#/media/File:CGA_palette_color_test_chart.png

My fragment shader looks like this:

varying vec2 v_vTexcoord;
varying vec4 v_vColour;

void main()
{
    gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
}
\$\endgroup\$
1
\$\begingroup\$

One way would be to have another 1D texture which holds your texture palette. You could then have a uniform which is an offset for the start of the palette. If you turn on texture wrapping, you can simply add the offset to the x coordinate when you sample the texture and you'll be able to rotate the palette.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.