# color not affecting the texture

This topic is 4240 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I am trying to add a color to the texture by using the color3ub function but for some reason I am not able to make the texture modulate the color. The following is the code I have.
   image.Bind();
glColor3ub(color.r, color.g, color.b);
glTexCoord2f(0, 0); glVertex2d(0, 0);
glTexCoord2f(1, 0); glVertex2d(256, 0);
glTexCoord2f(1, 1); glVertex2d(256, 32);
glTexCoord2f(0, 1); glVertex2d(0, 32);
glEnd();


I have tried forcing the glTexEnvi parameters as well and also have had blending enabled but it didn't work for some reason. Is there anything else I can try to check if the color gets added to the texture

##### Share on other sites
If your using lighting you're going to have to set the diffuse color of the material, not the vertex. I think there is a way to enable glcolor and lighting at the same time but I'm not sure off my head.

##### Share on other sites
Hi,

Thanks for the reply but lighting is disabled when this function is being called. What you are speaking about is probably GL_COLOR_MATERIAL. This is a simple quad in a 2d orthographics projection with no lighting at all.

Thanks

##### Share on other sites
Sounds like the texture environment for that particular texture is set to GL_REPLACE. You might want to try and change it to GL_MODULATE. This should pickup the lighting and the color of the geometry.

• 10
• 17
• 9
• 14
• 41