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

Author Topic: [SOLVED] sf::RenderTexture crash with latest SFML version (MSVC12)  (Read 1622 times)

0 Members and 2 Guests are viewing this topic.

Gigotdarnaud

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Hello,

I am experimenting an odd issue with this code:
#include <SFML/Graphics.hpp>

int main()
{

    sf::RenderTexture test;
    test.create(150, 150);

    sf::RectangleShape bg(sf::Vector2f(50, 50));
    bg.setFillColor(sf::Color(255, 0, 0));

    test.draw(bg);

    return 0;
}

The call to sf::RenderTexture::draw crashes the program.

I did not have this issue back when I used MSVC10 and the SFML 2.1 binaries downloaded from the site. Since I needed advanced C++11 features, I upgraded to MSVC12, built SFML from source using SFML Installer. Everything compiled as usual (it links just fine, the binaries were indeed made by and for MSVC12), until I started to call sf::RenderTexture to, well, render on a texture.

Note that sf::RenderWindow works just fine.

I am rebuilding SFML one more time right now, just in case something went wrong the first time, but it seems unlikely.

Any idea?


EDIT:
Even with the rebuild it crashes. I believe we can rule that one out.
« Last Edit: April 03, 2014, 03:06:13 pm by Gigotdarnaud »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: sf::RenderTexture crash with latest SFML version (MSVC12)
« Reply #1 on: April 03, 2014, 12:51:05 pm »
You should call clear() and display(), but I guess that's not the issue. Instead it's probably some context problem.

Please provide the full error message and the call stack when the application crashes.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Gigotdarnaud

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: [SOLVED] sf::RenderTexture crash with latest SFML version (MSVC12)
« Reply #2 on: April 03, 2014, 03:10:10 pm »
Problem solved!
As it turns out, the project had been using the wrong DLLs all along.

When building a new project in Visual Studio (I usually don't use it), the runtime couldn't find the DLLs, and when copied near the executable the code didn't crash anymore.
I returned to my usual development environment, did the same thing and voilà.
Out of curiosity, how come the call to the DLLs didn't crash closer to the app entry point? Aren't dynamic libraries version-ed or something?