I am angry, I lost 2 days for this library. Now I am sure IT ISN'T POSSIBLE TO LOAD JPG/BMP/PNG FILES using this library IN VISUAL STUDIO 2010 !! ilLoadImage throws error: IL_INVALID_EXTENSION ! Am I lonly with this error - NO - here are relative topics:
I have feeling this library isn't being maintained - which is a shame since its the only one that seems to load/save psd and dds files.
I think the problem the OP was running into is an incompatibility with wchar_t * in the loadimage function. For some reason, it requires a const wchar_t* parameter, but then treats the string as a regular const char* internally. SO… if you wish to get images to load, pass in a const char string and cast it to wchar_t* like this:
ILstring is defined as wchar_t*, so this is a const wchar_t* cast.
This also applies to the ilSaveImage function.
Since this is dubious from a safety standpoint, you might want to look at the ilLoadF functions instead and handle the filenames yourself. Can't help you there with specifics though, since the documentation hasn't been good enough for me to figure out how to get that to work either.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This didn't solve the problem.
I tried:
1. undef _UNICODE
2. define _UNICODE and casting to wchar_t*
3. define _UNICODE and converting to wchar_t*
still error 1291 (IL_INVALID_EXTENSION) after ilLoadImage
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am angry, I lost 2 days for this library. Now I am sure IT ISN'T POSSIBLE TO LOAD JPG/BMP/PNG FILES using this library IN VISUAL STUDIO 2010 !! ilLoadImage throws error: IL_INVALID_EXTENSION ! Am I lonly with this error - NO - here are relative topics:
http://sourceforge.net/projects/openil/forums/forum/13560/topic/4045391
http://sourceforge.net/tracker/?func=detail&aid=2990437&group_id=4470&atid=204470
http://www.gamedev.net/topic/586783-need-help-using-soil/
and much more
What are doing authors to correct this bug ? ANSWER: NOTHING ! I have been written to them and 0 answer.
Now I use SDL library which works !
I have feeling this library isn't being maintained - which is a shame since its the only one that seems to load/save psd and dds files.
I think the problem the OP was running into is an incompatibility with wchar_t * in the loadimage function. For some reason, it requires a const wchar_t* parameter, but then treats the string as a regular const char* internally. SO… if you wish to get images to load, pass in a const char string and cast it to wchar_t* like this:
ilLoadImage((const ILstring) "C:\\ImageFiles\\image.jpg")
ILstring is defined as wchar_t*, so this is a const wchar_t* cast.
This also applies to the ilSaveImage function.
Since this is dubious from a safety standpoint, you might want to look at the ilLoadF functions instead and handle the filenames yourself. Can't help you there with specifics though, since the documentation hasn't been good enough for me to figure out how to get that to work either.
This didn't solve the problem.
I tried:
1.
undef _UNICODE
2.
define _UNICODE
and casting towchar_t*
3.
define _UNICODE
and converting towchar_t*
still error 1291 (IL_INVALID_EXTENSION) after ilLoadImage