Jump to content
  • Advertisement
Sign in to follow this  
by321

drawing color tinted grayscale bitmaps

This topic is 2616 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 want to draw a grayscale bitmap multiplied with a color value. Let's say the color value is (r,g,b), and the value of a pixel in the grayscale bitmap is p, then (r*p/255,g*p/255,b*p/255) should be drawn for that pixel.

Another way of looking at it doing a polygon color fill, and using the grayscale bitmap as the alpha channel.

For each grayscale bitmap, I'd need to draw it in multiple "tints", each with a different color value.

An easy way to do this is creating multiple temporary textures, but it seems pretty inefficient and wasteful.

What's the best way to do this ? Is there a shader-less, single-pass solution ?

Share this post


Link to post
Share on other sites
Advertisement

Set the TexEnv state to GL_MODULATE and set the color with glColor.



Will try, thanks for the tip.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!