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

Author Topic: Assertion Failed when trying to load Texture  (Read 1311 times)

0 Members and 1 Guest are viewing this topic.

Bertrahm

  • Newbie
  • *
  • Posts: 1
    • View Profile
Assertion Failed when trying to load Texture
« on: December 02, 2019, 06:54:13 pm »
Hey,
im farely new to SFML and im having trouble when loadiong Textures. Im getting an Assertion Failed.
here's the message;
(click to show/hide)

Heres the class where I call the load texture:
(click to show/hide)
(LoadSprite calls LoadTexture, which really loads the texture)
And heres the class for my Window Creation and where I call the LoadSprite Function:
(click to show/hide)

It fails at window creation, but as soon as I remove the LoadSprite call it doesnt fail anymore and the other way arround

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Assertion Failed when trying to load Texture
« Reply #1 on: December 02, 2019, 08:23:07 pm »
Do you declare your Engine instance at global scope? Within main()? Somewhere else?
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Assertion Failed when trying to load Texture
« Reply #2 on: December 02, 2019, 08:31:01 pm »
As mentioned on Discord, your LoadTexture function isn't returning anything.

// Method for loading Textures
sf::Texture SpriteLoader::LoadTexture(string name) {
    sf::Texture texture;

    if(!texture.loadFromFile(GetResourceLocation()+"/"+name)) {
        cout << "[ERROR]HE: SpriteLoader: Texture failed to load! (" << name << ")" << endl;
    }
}

Not even sure how this code is compiling for you.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything