I am developing a bitmap font renderer for a 2D game using SDL 2. (If it matters, I'm using Debian 8 "jessie".) I had planned on storing the glyphs as a grayscale image, translating gray levels to alpha at load time. I realized I would want to draw text in more than one color. I had planned on coloring the rendered glyphs using SDL_SetTextureColorMod(glyphstex, r, g, b), with as a white texture. But the documentation for SDL_SetTextureColorMod states that this may not always work:

Color modulation is not always supported by the renderer; it will return -1 if color modulation is not supported.

In what cases is color modulation likely to be unsupported? In other words, how likely am I to need a fallback method in case the automatically chosen renderer does not support color modulation? Or is it better to render entire lines of text using software rendering and then somehow efficiently convert gray to alpha later? Or is it better to trace each glyph in FontForge in order to convert the bitmap font to an outline font for use with SDL_TTF instead of trying to make my own bitmap font renderer?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.