Jump to content
  • Advertisement
Sign in to follow this  
CRACK123

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.

If you intended to correct an error in the post then please contact us.

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);
   glBegin(GL_QUADS);
      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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!