Page 1 of 1
Display sprites with transparent background
Posted: Fri Jun 30, 2006 10:07 am
by yabune
Is it possible to display a png file with a transparent background?
I tried the DisplayTransparentSprite but it doesn't work with a 'transparent color'.
Do I have to paint the background of the png with a solid color?
thanks!
Re: Display sprites with transparent background
Posted: Fri Jun 30, 2006 10:52 am
by mskuma
yabune wrote:Do I have to paint the background of the png with a solid color
Yes, or you can do it using 3d sprites using a 32-bit PNG (with alpha) using something like:
Code: Select all
spriteNumber = LoadSprite(#PB_Any, PNGFilename, #PB_Sprite_Texture | #PB_Sprite_AlphaBlending)
sprite3DNumber = CreateSprite3D(#PB_Any, spriteNumber)
which maps the PNG as a texture to a 3D sprite, which I think is always facing the user, so in this way it will appear as a regular 2D image.
Posted: Fri Jun 30, 2006 1:37 pm
by dracflamloc
Or you can set the transparent color of that sprite to RGB(0,0,0) which is what PB translates the transparent color in png to.