about text

Hi all, got some questions, hope you can help me out here!

  1. In my game, I want some text to be displayed on the screen. What’s the best way to do this?
    Info: I have a 3D scene, right now I build a font from a TGA and write the text in Ortho.
    Problem: text is lit by the lights in my scene.
    The problem is solved by disabling the lights before writing the text but this sounds so stupid to me. I mean, isn’t there a more efficient way? I try not to use scissors here btw.

  2. You can see the black around each character. What blending method do I use to make a key color (black here) dissappear?

Thanks alot!

You might be able to create a material for your font that has 100% ambience, but I haven’t really experimented much with that sort of thing, so I wouldn’t really know. As for the blendmode, assuming your text is white and the background is black, you can use glBlendFunc(GL_SRC_ALPHA, GL_ONE) to do what you want. That is a good blendmode for things like fire, explosions, and anythig else where darker = more transparent. It’s comparable to the “Screen” filter in Adobe Photoshop.

Thank you TerranFury, I used 100% ambient for the text’s material and it looks the same, so it works The effect on my program is too small to notice, but I suppose that using the material is faster than switching the lights on and off.

The blending works too now, but there was quite a performance drop when I enabled it. When I enabled blending all the time, FPS went from 85 to 44. When only enabled to write the text it still drops from 85 to 66. I guess this is normal?

Anyways, thanks for the help!

Btw, I always get a warning when I compile a project:

LINK : warning LNK4089: all references to “ADVAPI32.dll” discarded by /OPT:REF

Doesn’t seem to affect my programs but I’m wondering what it is…

That warning simply means your linker was told to link with that library, but your program isn’t using any functions in the library so the references to library were discarded since they seemed to not be needed.
You can normally ignore this warning.