applying texture to the application surface

how to change the color of the application surface, using the 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

https://upload.wikimedia.org/wikipedia/commons/c/c5/CGA_palette_color_test_chart.png

my fragment shader start in this way:


varying vec2 v_vTexcoord;
varying vec4 v_vColour;

void main()
{
    gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
}

thanks

i think you are missing the texture sampler:


uniform sampler2D gm_BaseTexture;

if you want to use multiple textures, you have to explicitly assign a value to “gm_BaseTexture”:
c-code:


unsigned int textureunit = ..anynumber..;

// get sampler location:
int location = getUniformLocation(shader, "gm_BaseTexture");
// send texture location to the sampler:
glProgramUniform1i(shader, location, textureunit);
// bind texture to texture unit
glActiveTexture(GL_TEXTURE0 + textureunit);
glBindTexture(GL_TEXTURE_2D, texture);

i think you are missing the texture sampler:


uniform sampler2D gm_BaseTexture;

if you want to use multiple textures, you have to explicitly assign a value to “gm_BaseTexture”:
c-code:


unsigned int textureunit = ..anynumber..;

// get sampler location:
int location = getUniformLocation(shader, "gm_BaseTexture");
// send texture location to the sampler:
glProgramUniform1i(shader, location, textureunit);
// bind texture to texture unit
glActiveTexture(GL_TEXTURE0 + textureunit);
glBindTexture(GL_TEXTURE_2D, texture);

If I understood you well, you should better search in this direction.