How to use texture masking

Blitz3D Forums/Blitz3D Programming/How to use texture masking

JBR(Posted 2004) [#1]
Hello, what I am finding is that I have to go through the entire texture basically turning the alpha byte to 0 on pixels which have red/green/blue = 0.

Is this the way to do it?
Seems a bit strange but it does work.

tex = CreateTexture( 1024, 1024, 4+256 ) ; mask + VRam
EntityTexture Mesh_A%, tex

Thanks
Marg


poopla(Posted 2004) [#2]
Yeah, with created texture's masking doesn't work right off the bat... I've always found that to be a bit... stupid :).


DrakeX(Posted 2004) [#3]
all the mask flag does is add an alpha channel. when you use it with LoadTexture(), blitz goes through each pixel and gives each 0,0,0 pixel an alpha of 0 and all others an alpha of 255. when you create your own masked texture, it doesn't really have any way of going through and performing the masking, as you're going to be drawing to the texture anyway. so you have to do it manually (though if B3D had a built-in MaskTexture(tex,r,g,b) command, that'd be great). remember - 3d cards do not have the ability to "blit" textures with a certain mask color - it's all done manually with the alpha channel.


JBR(Posted 2004) [#4]
Thanks
Marg