i'm seeing this strange white outline on my sprites in sfml:
http://s1190.photobucket.com/albums/z449/m75214/
is this a bug in sfml?
here's the sprite image:
http://i1190.photobucket.com/albums/z449/m75214/stand_22222.png
bug in sfml?
I'm not sure if i understand your problem. I think you mean you are seeing white background behind you image or sprite.
you can make the white background color of you sprite to disappear by making it transparent, you can do that by using the following like of code.
you can make the white background color of you sprite to disappear by making it transparent, you can do that by using the following like of code.
sf::Image Image;
Image.CreateMaskFromColor(Color.White);
//Or
Image.CreateMaskFromColor(sf::Color(255, 255, 255));
That png allready have transparent background, the code that loads and renders the sprite would probably help here.
That png allready have transparent background, the code that loads and renders the sprite would probably help here.
sf::Image stand_Image;
stand_Image.LoadFromFile("stand_22222.png");
sf::Sprite stand_Sprite;
stand_Sprite.SetY(200.f);
stand_Sprite.SetImage(stand_Image);
stand_Sprite.SetBlendMode(sf::Blend::Alpha);
App.Draw(stand_Sprite);
How do I do that with SFML?
AFAIK, you don't. There was a discussion last year about adding support to SFML, but as per usual, it hasn't actually happened.
You can manually patch the source code as describe there.
[quote name='ms75214' timestamp='1328561532' post='4910286']
How do I do that with SFML?
AFAIK, you don't. There was a discussion last year about adding support to SFML, but as per usual, it hasn't actually happened.
You can manually patch the source code as describe there.
[/quote]
This does not seem to be the problem.
I have used the following code to render the texture in a different program, and it looks fine:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBindTexture( GL_TEXTURE_2D, texture );
glBegin (GL_QUADS);
glTexCoord2f(0, 0);
glVertex2f(-2, -2);
glTexCoord2f(1, 0);
glVertex2f(2, -2);
glTexCoord2f(1, 1);
glVertex2f(2, 2);
glTexCoord2f(0, 1);
glVertex2f(-2, 2);
glEnd ();
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
I have used the following code to render the texture in a different program, and it looks fine:
Did you render it on a black background, at a similarly large size?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement