zyedidia / SFML.jl

A binding of the game and multimedia library SFML for Julia
Other
93 stars 22 forks source link

Any idea how to do transparent textures? #15

Closed IainNZ closed 8 years ago

IainNZ commented 8 years ago

I have some PNGs with some alpha=0 pixels, but unfortunately they're drawn with an opaque background. Any idea how to do it?

IainNZ commented 8 years ago

Maybe http://www.sfml-dev.org/documentation/2.0/classsf_1_1Image.php#a22f13f8c242a6b38eb73cc176b37ae34, but this isn't wrapped right now, right?

zyedidia commented 8 years ago

Are you using a sprite to draw the image? In the image.jl example, the image is transparent, but the background is white. If you change the last bit of the code in image.jl (the draw sequence), you can really see the transparency of the logo image:

# Clear the screen and redraw the sprite
clear(window, SFML.white)
draw(window, logo)
move(logo, Vector2f(-50, 10))
draw(window, logo)
move(logo, Vector2f(50, -10))
display(window)
IainNZ commented 8 years ago

I'm using a set_texture on a RectangleShape(), I'll try a Sprite

IainNZ commented 8 years ago

Oh man, RectangleShape works fine, its just that I wasn't drawing the background! Ignore me :+1:

screen shot 2015-11-23 at 1 17 45 pm