I have many mesh objects in my scene and I have applied an image texture to some objects but I want to set different colors for the other objects. How do I do that? This is my fragment shader
#version 430 core
out vec4 color;
in VS_OUT
{
vec2 tc;
vec3 normals;
}
fs_in;
layout(binding=0)uniform sampler2D tex;
// uniform mat4 model_matrix;
void main(void)
{
color= texture(tex, fs_in.tc);
}
This is my code
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture[0]);
GLint tex_location = glGetUniformLocation(program, "tex");
glUniform1i(tex_location, 0);
Fence.Draw();
glActiveTexture(GL_TEXTURE0 + 1);
glBindTexture(GL_TEXTURE_2D, texture[1]);
GLint tex_location1 = glGetUniformLocation(program, "tex");
glUniform1i(tex_location1, 1);
Ground.Draw();
glActiveTexture(GL_TEXTURE0 + 2);
glBindTexture(GL_TEXTURE_2D, texture[2]);
GLint tex_location2 = glGetUniformLocation(program, "tex");
glUniform1i(tex_location2, 2);
O_Roof.Draw();
glActiveTexture(GL_TEXTURE0 + 3);
glBindTexture(GL_TEXTURE_2D, texture[3]);
GLint tex_location3 = glGetUniformLocation(program, "tex");
glUniform1i(tex_location2, 3);
O_BlueCandies.Draw();
Say I want to add the color blue to O_BlueCandies object and the color red to another one and so on how can I do that?