问题
Since drawing fonts is quite expensive in terms of CPU, many developers use a rasterized font to draw text on video games; that's what I did too.
Using additive blending when drawing the text works fine regarding glyph edges, these merge nicely with the background color.
But it brought another issue,
I decided to implement a 'color' parameter for drawing the font, instead of producing glyphs bitmaps for each color, otherwise memory usage might be an issue soon; depending how many glyphs and colors are needed but also the font size and since it supports Unicode, there can be thousands of glyphs needed depending the language.
Now when I blend, say a 'Green' font on a 'Red' background, it goes 'Orange' ! Which is the purpose of additive blending, but trying to bypass this went a little more complicate than expected. Obviously it doesn't happen when background is 'Black' but it might not be that color in the end.
How can I recolor my 'White' font to 'Any' color, while still retaining additive blending over 'Any' color ?
Thanks a lot :D
回答1:
I have fixed it, here's the answer !
来源:https://stackoverflow.com/questions/4750290/question-about-additive-blending-and-hue-replacement