Jump to content
  • Advertisement
Sign in to follow this  
McGrane

Problem with sprites and colors

This topic is 4884 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

Like the title says i am having trouble using sprites and colors together. If i have all the sprites on the screen and than us something like glColor2f(1.0f, 0.0f, 0.0f); It makes all the sprites turn red. Can anyone tell me how to fix it? Many thnx, --mcgrane66

Share this post


Link to post
Share on other sites
Advertisement
What were you expecting, if not that?

glColour sets the colour state for all vertices rendered from that point until the colour is changed. If you change vertex colours, then unless you change the texture function used in the texture pipeline, the textures on the polys you render will have their pixel colours modulated by the respective fragment colours.

Share this post


Link to post
Share on other sites
Yea i know thats whats happening, but what im asking is can i use colors and textures in anyway - I want to be able to make about 1/4 of the screen gray, without having to use new textures

Share this post


Link to post
Share on other sites
Perhaps you could give a fuller explanation of precisely what you want. I'm still not sure what you mean.

When you say a quarter of the screen, do you mean you want to have the background colour gray and put sprites over three quarters of the screen? Or that you want to render sprites with the same texture over the whole screen, but have a quarter of them gray? I'm guessing it's the latter.

If you want to render sprites with the same texture but different vertex colours, just set the vertex colour (using glColour) to gray before you render the sprites that you want to be gray. If necessary, set the colour before you render each sprite.

Share this post


Link to post
Share on other sites
use glColor3f(1.0f, 1.0f, 1.0f) before rendering any textured objects.
when you are ready to render your normal objects w/out color, just use glDisable(GL_TEXTURE_2D), then you can color away.

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!