bug in sfml?

Started by
10 comments, last by swiftcoder 12 years, 2 months ago
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
Advertisement
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.


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.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

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);
SFML specific issues should probably go to the SFML forum:
http://sfml-dev.org/forum/

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

You need to use pre-multiplied alpha.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]


You need to use pre-multiplied alpha.



How do I do that with SFML?

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.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]


[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?

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

This topic is closed to new replies.

Advertisement