I’m developing a 2D real-time display of radar imagery that includes the display of time, location, etc. at the corners of the image.
What I’m doing is very straightforward: set the GL_PROJECTION matrix, create a gluOrtho2D(), set GL_MODELVIEW, etc. and then map a texture containing the image to a quad. After that, I use glutBitmapCharacter() to display the text.
This all works great as long as the bitmap isn’t too dark. If the bitmap is very dark, or black, the text can’t be seen. (This doesn’t depend much on the color of the text.) I’ve experimented with every glBlenFunc() combination I can find…
How can I make the text always show up? Any suggestions would be appreciated!
I’m not completely sure I understand the question, especially this:
(This doesn’t depend much on the color of the text.)
Surely the color of the text makes a major difference whether it has good contrast with the background it is drawn on?
Anyway, I think you may want to take a look at glLogicOp.
Consider a drop shadow. When drawing on a light background, draw text in black, then draw text using desired colors one pixel up and one pixel left. When drawing on a dark background, draw text in white, then draw text using desired colors one pixel up and one pixel left.
Thanks! glLogicOp(GL_SET) is certainly a big improvement. One remaining item is that the text should be green, but when using glLogicOp(), the text is white. Is there something else I need to do?
Thanks! glLogicOp(GL_SET) is certainly a big improvement.
Huh? That just draws the text in white (as you’ve noticed), so why not draw the text in white in the first place - or green for that matter?
Whatever color I tried, white, green or anything else, if glLogicOp() isn’t called, the text “flickers” and disappears/reappears as the texture, a constantly changing radar image updated in real-time, under the text changes.
As I originally noted, I couldn’t find a combination of glBlenFunc() parameters that would make the text remain visible.
Again, thanks for the suggestion to use glLogicOp(). Without that, the text display was unreadable much of the time.
if glLogicOp() isn’t called, the text “flickers” and disappears/reappears as the texture, a constantly changing radar image updated in real-time, under the text changes.
Hmm, that sounds a bit as if you are not drawing the text consistently after the radar image (but perhaps only if the text changes?). I don’t see why glLogicOp would make a difference though. Do you disable depth testing when rendering the text?
The image is updated on a timer, and each time through the routine the text is updated after the texture. I definitely disable depth testing.
Maybe this is related to some interaction between the tools I’m using, Envitia MapLink and a Qt QGLWidget.