Problem: IMG_Load only works first time -.-

Hi all,

I’m having strange problem using IMG_Load, I’m trying to load some PNGs to create textures, but something wrong happens because the first PNG always has been loaded, but after that, I can’t load any more png. At first I though that it was a path problem so I created a temporal code:

SDL_Surface* Image = IMG_Load( strNomText.c_str() );
SDL_Surface* temp = IMG_Load( strNomText.c_str() );

But when I’m debbuging this piece of code I see that Image is not Null and temp has Null value, and as you can see, Image and temp are using the same arguments to be created, so at the end I don’t know if I have to do something between 2 IMG_Load that free resources or something like that, that allows IMG_Load to works again :S.

Keeping in mind this idea I put SDL_Delay between to IMG_Load or SDL_FreeSurface from Image, but this 2 ideas doesn’t work too.

Thats 4 help me people :smiley:

I’m having strange problem using IMG_Load, I’m trying to load some PNGs to
create textures, but something wrong happens because the first PNG always
has been loaded, but after that, I can’t load any more png.

Try again with the latest version of SDL_image. There was a bug…Am Sonntag, dem 22. Nov 2009 schrieb n3wrotyk:


AKFoerster