if it's a 24 Bit PNG, the transparent color needs to be black when loaded with Flag 4 (masked) or as Genexi said, 2 for alpha transparency. With alpha-transparency it works this way: the darker the pixels of the texture, the more transparent they are.
(Note: unlike with Mode Flag 4, using Mode 2 can cause Z-Order problems when you have mutliple alpha-transparent objects in a scene)
From what you said you rather want to use a mask, so use something like
tex=loadtexture("x.png",4)
While PNG and GIF do know some kind of "transparent" color, Blitz expects those parts to be black (0,0,0).
If you are using 32 Bit PNG, the highest 8 Bits, aka channel 4, are used as alpha channel. This way you can set the transparency of each pixel independently from its brightness. If you use Flag 4 here, the alpha-channel pixel must be Zero to be transparent. So basicly its:
with 24 Bits you have
Red-Green-Blue channels, and black is transparent (in Mode 4)
with 32 Bits you have
Alpha-Red-Green-Blue channels, and the transparency is defined in the alpha channel, in Mode 4 pixels need to be Zero for transparency, in Mode 2 it may be any value from 0 to 255 for a more or less transparent pixel.
Please note: due to mipmapping and filtering processes, the contours of a masked texture may look darkish, fading to black, especially when watched from the distance. You surely want to prevent this ugly behaviour, there are two ways:
-use an Alpha channel that defines the masked parts and on the RGB channels use a background color that fits with the main colors of the object, example: when its some leaf, use a green background.
-method 2: load the texture and replace each texel that is black with a texel that has a better color for the background (as described) and simply set the alpha channel of those texels in the texturebuffer to zero.
Example:
; (assuming the masked parts are black, 24 Bit PNG and it's some green stuff on the texture, eg. leaf etc.)
tex=loadtexture("tex.png")
setbuffer texturebuffer(tex)
lockbuffer()
for j=0 to textureheight(tex)-1
for i=0 to texturewidth(tex)-1
rgb=readpixelfast(i,j) and $FFFFFF
if rgb=0 ; if it's black
writepixelfast i,j,$0000AA00 ; write a greenish pixel, alphabyte=0
endif
next
next
unlockbuffer()