CreateTexture mask

Blitz3D Forums/Blitz3D Programming/CreateTexture mask

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

if you are using drawing commands on a texture buffer, alpha channel information will be lost. It is however a good idea to touch up the alpha channel information manually to prevent black edges due to texture filtering:

if a texel is black (assuming this should be transparent!) then
-Read the rgb of all surrounding texels that are not transparent as well.
-Calcualte the average RGB of them, then set the transparent center texel this way:
alpha=0
argb= (average_rgb and $FFFFFF) or (alpha shl 24)
endif

this way the edges of the masked parts will fade to a color that makes more sense than black.

EDIT: I just posted an example in the archives:
http://www.blitzbasic.com/codearcs/codearcs.php?code=1806