Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help loading with DevIL (developer's image library)
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
CodeMonkey2000




PostPosted: 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;
}
Sponsor
Sponsor
Sponsor
sponsor
Homer_simpson




PostPosted: 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
CodeMonkey2000




PostPosted: 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.
Homer_simpson




PostPosted: 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
CodeMonkey2000




PostPosted: 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.
DemonWasp




PostPosted: 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.
CodeMonkey2000




PostPosted: 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.
Homer_simpson




PostPosted: 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?
Sponsor
Sponsor
Sponsor
sponsor
CodeMonkey2000




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: