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



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 );

1 Answer 1


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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .