Author |
Message |
CodeMonkey2000
|
Posted: Tue Jan 27, 2009 2:01 pm Post subject: Help loading with DevIL (developer's image library) |
|
|
Hey guys, for some reason ilLoadImage isn't able to load any images. I have no idea why. I tried to see what error is generated, but that didn't help, it just outputs "i". Anyone here experienced with this library?
c++: | bool texture::loadImage(char* fileName)
{
//initialization
if (!devInit)
{
ilInit();
iluInit();
ilutInit();
devInit = true;
cout<<"yes\n";//this happens
}
ILuint imgId = 0;
ilGenImages(1, &imgId);
ilBindImage(imgId);
if (!ilLoadImage(fileName))//for some reason it didn't open the picture
{
ILenum error;
error = ilGetError();
cout<<iluErrorString(error)<<endl;//this outputs "i" I don't even know what that means
return false;
}
width = ilGetInteger(IL_IMAGE_WIDTH);
height = ilGetInteger(IL_IMAGE_HEIGHT);
bpp = ilGetInteger(IL_IMAGE_BPP);
if (pixelData)
delete [] pixelData;
pixelData=new unsigned char [width * height];
ilCopyPixels(0, 0, 0, width, height, 1, IL_RGB, IL_UNSIGNED_BYTE, pixelData);
ilBindImage(0);
ilDeleteImage(imgId);
return true;
} |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Homer_simpson
![](http://compsci.ca/v3/uploads/user_avatars/18138546704b4d2a3b2e50e.gif)
|
Posted: Tue Jan 27, 2009 3:24 pm Post subject: Re: Help loading with DevIL (developer's image library) |
|
|
that's wierd,
try this see if u get a full error
c++: |
ILenum Error;
while ((Error = ilGetError()) != IL_NO_ERROR) {
printf("%d: %s/n", Error, iluErrorString());
} |
took it from openil website
Mod Edit: You forgot to specify the language in the syntax tags (which is "cpp" for C++) ![Smile Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Tue Jan 27, 2009 5:18 pm Post subject: RE:Help loading with DevIL (developer\'s image library) |
|
|
It says 1290: could not open file. Mabey I installed it wrong. I put all the headers in the include file in the include file of minGW, I put everything from lib into the lib file of minGW (though there was a folder called unicode with different versions of the lib files) and I put all the .dll's in my system32 folder. |
|
|
|
|
![](images/spacer.gif) |
Homer_simpson
![](http://compsci.ca/v3/uploads/user_avatars/18138546704b4d2a3b2e50e.gif)
|
Posted: Wed Jan 28, 2009 12:24 pm Post subject: Re: Help loading with DevIL (developer's image library) |
|
|
i dont think it's an installation problem since your not getting a compiler error, did you specify the path to the file properly? directories are specified with / rather than \ . just a thought |
|
|
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Wed Jan 28, 2009 1:29 pm Post subject: RE:Help loading with DevIL (developer\'s image library) |
|
|
Yes I am pretty sure I specified the path properly. All the images I tried are in the same folder as my project. |
|
|
|
|
![](images/spacer.gif) |
DemonWasp
|
Posted: Wed Jan 28, 2009 1:43 pm Post subject: RE:Help loading with DevIL (developer\'s image library) |
|
|
Depending on how your IDE works, it may not pick up the path to your project; it may pick up the path to its own installation directory instead. Are you using similar methods to load any other kind of file?
Try specifying the absolute path name instead of a relative path. |
|
|
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Wed Jan 28, 2009 9:03 pm Post subject: Re: Help loading with DevIL (developer's image library) |
|
|
Ok it is a path issue. When the image is in the C drive I have to type in "/image.extension". So how do I make it relative? With SDL_image I never had to worry about this. |
|
|
|
|
![](images/spacer.gif) |
Homer_simpson
![](http://compsci.ca/v3/uploads/user_avatars/18138546704b4d2a3b2e50e.gif)
|
Posted: Wed Jan 28, 2009 11:50 pm Post subject: Re: Help loading with DevIL (developer's image library) |
|
|
what is the absolute path of the compiled file on your computer?
what is the absolute path of the image? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Wed Jan 28, 2009 11:55 pm Post subject: RE:Help loading with DevIL (developer\'s image library) |
|
|
Hmm. For some reason when I run the exe by itself I have no problem, but when I run it through Code::Blocks it had problems finding the image. |
|
|
|
|
![](images/spacer.gif) |
|