I feel dumb - No Sprite Alpha?

Blitz3D Forums/Blitz3D Beginners Area/I feel dumb - No Sprite Alpha?

_PJ_(Posted 2007) [#1]
img=CreateTexture(256,256)

SetBuffer TextureBuffer(img)
Color 255,0,0
Oval 0,0,256,256,1
Color 0,0,0
Oval 8,8,240,240,1
Flip
SetBuffer BackBuffer()

Color 0,255,0

sp=CreateSprite()
EntityTexture sp,img


I have even tried setting the Texture Flag (on the img texture) to 2 but the sprite refuses to show transparency through the black background.

I really dont know what Im missing here!


big10p(Posted 2007) [#2]
When you use CreateTexture, you have to write the alpha value explicitly to every pixel. Don't ask! ;)


_PJ_(Posted 2007) [#3]
OH gawd! *sigh*

The only reason I used createtexture was because I just wanted to whip something up quickly hehe (laziness rules!). Oh well, here I go and open paint!

Thanks a lot!


jfk EO-11110(Posted 2007) [#4]
As soon as you paint to the texturebuffer, the alpha channel is erased. Writing a little ALpha setting function should be easy tho. It also allows not only to use the brightness of a texel for its transparency (as the systems alpha loading does when no alpha channel was found in the file), but for example the red channel, a certain brightness bias and so on.


IPete2(Posted 2007) [#5]
I wish I knew what you were talking about JFK!

Lol.

IPete2.


Sledge(Posted 2007) [#6]
http://www.blitzbasic.com/Community/posts.php?topic=64678#722116