Jump to content
  • Advertisement
Sign in to follow this  
ms75214

bug in sfml?

This topic is 2505 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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));

Share this post


Link to post
Share on other sites

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);

Share this post


Link to post
Share on other sites

[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);

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!