Disable antialias selectively on font drawing for color key

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Disable antialias selectively on font drawing for color key

Post by robmar »

I´m trying to find a way to draw gui text with antialias off at certain times.

The idea is that a shader uses the background color to color-key the text onto a moving background.

But with antialias globally enabled the text has a nasty jagged edge around it.

Any one know how to do this?
Marthog
Posts: 31
Joined: Sun Oct 03, 2010 8:33 pm
Contact:

Re: Disable antialias selectively on font drawing for color

Post by Marthog »

1. Use alphachannel
or
2. calculate the alpha value (e.g. white isfull visible, black is invisible and grey is half visible) - does not work with different colored fonts.
Rust fanboy
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Disable antialias selectively on font drawing for color

Post by robmar »

thanks, I´m not sure how to use alphachannel. I´m using A8R8G8B8 textures, antialias is enabled.

I need to draw text onto the texture with the background area filled with alpha set off.

I tried loading a PNG image with the alpha at zero and drawing the text foreground only over it, but there seems to be no alpha on the pixels set font->draw(..)
Post Reply