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

Author Topic: graphics tutorial code not working - Image.LoadFromFile  (Read 1582 times)

0 Members and 2 Guests are viewing this topic.

pentex

  • Newbie
  • *
  • Posts: 7
    • View Profile
graphics tutorial code not working - Image.LoadFromFile
« on: October 31, 2010, 10:02:09 pm »
I've downloaded the graphics-sprite tutorial source code but when I run it with an image of my own the program crashes. The only change I've made to the code is:

if (!Image.LoadFromFile("sprite.tga"))
        return EXIT_FAILURE;

if (!Image.LoadFromFile("C:\\zorg_logo.png"))
        return EXIT_FAILURE;

Replacing the sprite.tga file with one of my own. I originally put the zorg_logo image in the folder containing the project file. I also put it in all other folders I thought it might read it from, including the folder containing the solution, and the debug folder containing the executable. And as you can see I've now tried just putting the image in the C:\\ directory to try loading it from there but that doesn't work either.

When I run debug in VS2008 it points to the "if (!Image.LoadFromFile("C:\\zorg_logo.png"))" line and gives the error:

"First-chance exception at 0x72e065af in sfmlGraphicsSprite.exe: 0xC0000005: Access violation reading location 0xcccccccc.
A buffer overrun has occurred in sfmlGraphicsSprite.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program."

The strange thing is that when I run the code from the previous tutorial (graphics-window) it also gives a similar error, however this time pointing to the "App.Display();" line. This is particularly strange because in the tutorial code there is no image being loaded. So I don't know why I can successfully run the previous tutorial code in the Window section but not this code in the graphics section.

Ideas are much appreciated - thanks!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
graphics tutorial code not working - Image.LoadFromFile
« Reply #1 on: November 01, 2010, 11:01:35 am »
Make sure that you don't use release SFML libraries in debug mode.
Laurent Gomila - SFML developer

pentex

  • Newbie
  • *
  • Posts: 7
    • View Profile
graphics tutorial code not working - Image.LoadFromFile
« Reply #2 on: November 01, 2010, 04:56:00 pm »
That fixed it, thanks :)