I’m trying to draw masked sprites with antialias. For example, let say I have a texture which is letter A, it has two colors, white for the solid pixels (alpha=1.0), and magenta for the background (alpha=0.0), then I render this texture as a 2D texture quad using GL_LINEAR as filters (for antialias), and I use the Alpha Test to skip background pixels, the problem is that the antialiased parts is a mix of white and magenta scaled colors… how can I render this sprite (texture) with both masking and antialias ??, the antialias I want it to be mixed with the scene background not with the sprite’s mask color…
It’s very simple actually. When you load an image from disk you process it to add alpha channel right? Simply fill your texture with white color during that process so there are no more magenta pixels. Only white+alpha=1.0 and white+alpha=0.0
There is no other way.
You have to understand that both alpha and color channels are interpolated.
This is what you want, else there would be hard blocky edges around your letters.
If your are lazy, find the average color of your “sprite” and use that as background. Use Medium grey if you are really lazy…
There is no other way.
There is one and I’m using it - I paint images with alpha channel and save to PNG (it supports alpha cannels). I do all necessary color bleeding in Paint Shop Pro - my application just loads these images and oesn’t have to do anything with it - just display.