Can't get sprite texture to mask...

Blitz3D Forums/Blitz3D Programming/Can't get sprite texture to mask...

That sounds like bi-linear filtering to me. No way to turn that off at the moment. It has been requested though, so you never know what future updates might allow.

In the meantime try making the texture bigger, or... Theres a neat thing you can do if you are masking textures and bearing in mind you can have the maskcolor any color you like if you are using the read/write pixel method. Taking your white circle as an example set the background color to 254,254,254 say, then mask out this nearly white part. Now the bilinear filtering will be much less obvious on the white circle that remains. In general use mask colors that are close to but not the same as the colors that will be left after masking if you want this sort of effect.

This gives the general idea. I am being a bit naughty here by drawing directly to the texture. It usually works ok though, but the recommended method of writing to textures is by sole use of readpixel/writepixel.

texture=CreateTexture(128,128,4)
SetBuffer TextureBuffer(texture)
maskred=254 : maskgreen=0 : maskblue=0
maskrgb=maskred Shl 16 Or maskgreen Shl 8 Or maskblue
Color maskred,maskgreen,maskblue
Rect 0,0,128,128
Color 255,0,0
For i = 0 To 128 Step 16
	Rect i,0,1,128 	Rect 0,i,128,1
Next

For i=0 To 127
	For j=0 To 127
		argb=ReadPixel(i,j,TextureBuffer(texture))
		rgb= argb And $FFFFFF
		If rgb=maskrgb Then alpha=0 Else alpha=255
		WritePixel i,j,alpha Shl 24+rgb,TextureBuffer(texture)
	Next
Next