Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: .SetBlendMode(sf::Blend::None); has no effect...  (Read 4263 times)

0 Members and 1 Guest are viewing this topic.

JeZ-l-Lee

  • Jr. Member
  • **
  • Posts: 80
    • ICQ Messenger - 223180991
    • MSN Messenger - JeZLee@Live.com
    • AOL Instant Messenger - SLNTHERO@aol.com
    • View Profile
    • http://www.SilentHeroProductions.com
    • Email
.SetBlendMode(sf::Blend::None); has no effect...
« on: March 02, 2009, 03:00:03 pm »
Hi,

Trying to turn OFF blending for a Sprite.

MySprite.SetBlendMode(sf::Blend::None); has no effect...

Using current SFML from SVN

Any help would be appreciated...
JeZ+Lee
Silent Hero Productions(R)
Video Game Design Studio

http://www.SilentHeroProductions.com

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
.SetBlendMode(sf::Blend::None); has no effect...
« Reply #1 on: March 02, 2009, 04:40:25 pm »
Can you please give more details?
Laurent Gomila - SFML developer

JeZ-l-Lee

  • Jr. Member
  • **
  • Posts: 80
    • ICQ Messenger - 223180991
    • MSN Messenger - JeZLee@Live.com
    • AOL Instant Messenger - SLNTHERO@aol.com
    • View Profile
    • http://www.SilentHeroProductions.com
    • Email
.SetBlendMode(sf::Blend::None); has no effect...
« Reply #2 on: March 02, 2009, 05:08:07 pm »
Quote from: "Laurent"
Can you please give more details?


Hi,

Yes here is some more detail:
(OS is Windows Vista 32bit SP1)




Code: [Select]
//----------------------------------------------------------------------------------------------------------
bool Tiles::LoadAndInitializeTiles(void)
{
int posX;
int posY;
int tileWidth = 32;
int tileHeight = 32;
sf::IntRect rect;
sf::Color transparentColor;
sf::Color colorToSetNoTransparency(126, 0, 0, 255);

SelectedTile.Resize(32, 32);
SelectedTile.SetColor( sf::Color(0, 0, 0, 128) );

TilesSheet = new sf::Image;
if (!TilesSheet->LoadFromFile("data/graphics/in_game/SMBEnginE.png"))
return EXIT_FAILURE;

posX = 0;
posY = 0;

transparentColor = TilesSheet->GetPixel(posX, posY);

rect.Top = posY + 1;
rect.Bottom = posY + 1 + tileHeight;
rect.Left = posX + 1;
rect.Right = posX + 1 + tileWidth;

if (!TilesArray[0].TilesImage.LoadFromFile("data/graphics/in_game/32x32.png"))
return EXIT_FAILURE;

TilesArray[0].TilesImage.Copy(*TilesSheet, 0, 0, rect);

if (transparentColor != colorToSetNoTransparency)
TilesArray[0].TilesImage.CreateMaskFromColor(transparentColor, 0);

TilesArray[0].TilesSprite.SetImage(TilesArray[0].TilesImage);

TilesArray[0].TilesSprite.SetBlendMode(sf::Blend::None);

TilesArray[0].TilesSprite.SetCenter(TilesArray[0].TilesSprite.GetSize() / 2.f);

delete TilesSheet;
return EXIT_SUCCESS;
}
//----------------------------------------------------------------------------------------------------------
JeZ+Lee
Silent Hero Productions(R)
Video Game Design Studio

http://www.SilentHeroProductions.com

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
.SetBlendMode(sf::Blend::None); has no effect...
« Reply #3 on: March 02, 2009, 05:21:27 pm »
I think you misunderstand what the blend mode is ;)

Here it's working perfectly, otherwise your transparent white would be transparent. If you're talking about disabling the pixel bilinear filter, you should rather try calling SetSmooth(false) on your image.
Laurent Gomila - SFML developer

JeZ-l-Lee

  • Jr. Member
  • **
  • Posts: 80
    • ICQ Messenger - 223180991
    • MSN Messenger - JeZLee@Live.com
    • AOL Instant Messenger - SLNTHERO@aol.com
    • View Profile
    • http://www.SilentHeroProductions.com
    • Email
.SetBlendMode(sf::Blend::None); has no effect...
« Reply #4 on: March 02, 2009, 05:25:36 pm »
Quote from: "Laurent"
I think you misunderstand what the blend mode is ;)

Here it's working perfectly, otherwise your transparent white would be transparent. If you're talking about disabling the pixel bilinear filter, you should rather try calling SetSmooth(false) on your image.



YES, it works now by calling the other function!!!!

Thanks man, was trying to get this to work for 3 hours....
JeZ+Lee
Silent Hero Productions(R)
Video Game Design Studio

http://www.SilentHeroProductions.com