Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Cannot Load Image

Help
Anonymous
2010-06-04
2013-05-02

  • Anonymous
    2010-06-04

    I am trying to use this with windows and finding it very difficult to figure out as there are no mfc apps that I can use to see it work.
    The one in examples cannot be compiled because there are no resources to go with the resource file.

    I have included the 1.7.99 includes and lib files using the x64 bit DevIL.lib.

    This in stdafx.h

    //Image Library for 64 bit
    #include <IL/il.h>
    #include <IL/ilu.h>
    #include <IL/ilut.h>
    #ifdef ILUT_USE_SDL
    #include <sdl.h>
    #endif

    This in imageview.cpp

    m_csImageName = "c:\\test.jpg";

    ilInit();

    // Generate the main image name to use.
    ilGenImages(1, &ImgId);

    // Bind this image name.
    ilBindImage(ImgId);

    //if(!ilLoadImage((char*)(LPCSTR)m_csImageName))
    if(!ilLoadImage(m_csImageName))
    AfxMessageBox("error");

    m_nWidth = ilGetInteger(IL_IMAGE_WIDTH);
    m_nHeight = ilGetInteger(IL_IMAGE_HEIGHT);
    m_nDepth = ilGetInteger(IL_IMAGE_DEPTH);

    I get "error" every time.

     

  • Anonymous
    2010-06-04

    2010-06-04 18:52:09 GMT
    I am trying to use this with windows and finding it very difficult to figure out as there are no mfc apps that I can use to see it work. The one in examples cannot be compiled because there are no resources to go with the resource file.

    I have included the 1.7.99 includes and lib files using the x64 bit DevIL.lib.

    This in stdafx.h

    //Image Library for 64 bit 
    #include <IL/il.h> #include <IL/ilu.h> 
    #include <IL/ilut.h> #ifdef ILUT_USE_SDL 
    #include <sdl.h> 
    #endif
    

    This in imageview.cpp

    m_csImageName = "c:\\test.jpg"; ilInit(); 
    // Generate the main image name to use.
     ilGenImages(1, &ImgId); // Bind this image name. 
    ilBindImage(ImgId); 
    //if(!ilLoadImage((char*)(LPCSTR)m_csImageName)) 
    if(!ilLoadImage(m_csImageName)) 
         AfxMessageBox("error"); 
    m_nWidth = ilGetInteger(IL_IMAGE_WIDTH); 
    m_nHeight = ilGetInteger(IL_IMAGE_HEIGHT); 
    m_nDepth = ilGetInteger(IL_IMAGE_DEPTH);
    

    I get "error" every time.

     

  • Anonymous
    2010-06-07

    Are there any compiled examples of this that actually work? I just need to display an image on a dialog. It can't be that hard, not sure what the problem is though.

     

  • Anonymous
    2010-06-07

    i finally got ilLoadImage to return successful after including following header files in project.
    config.h
    config.h.in
    devil_cpp_wrapper.hpp
    devil_internal_exports.h
    il.h

    and putting devil.dll in program directory but now I cannot get ilGetInteger to work.

        ilInit();
        // Generate the main image name to use.
        ilGenImages(1, &ImgId);
        // Bind this image name.
        ilBindImage(ImgId);
        if(!ilLoadImage((char*)(LPCSTR)m_csImageName))
            AfxMessageBox("error");
        m_nWidth = ilGetInteger(IL_IMAGE_WIDTH);
        m_nHeight = ilGetInteger(IL_IMAGE_HEIGHT);
        m_nDepth = ilGetInteger(IL_IMAGE_DEPTH);
        m_nWidth = ilGetInteger(IL_IMAGE_WIDTH);
        m_nHeight = ilGetInteger(IL_IMAGE_HEIGHT);
        m_nDepth = ilGetInteger(IL_IMAGE_DEPTH);
    

    all return 0. why?

     
  • Denton Woods
    Denton Woods
    2010-06-09

    Your code should work fine.  I don't see any problems there.  I would not recommend trying 1.7.99, since it looks to not be ready for Windows systems.

     

  • Anonymous
    2010-07-29

    i tried 1.7.8 and still get the same thing.
    I just need to display an image on a dialog, is there any example program that works that i can see?

     

  • Anonymous
    2010-08-09

    Do I need to make sure something is included? which lib? which .h?

     

  • Anonymous
    2010-08-09

    Would this work? I put this in OnPaint()
    CRect rectWnd;
    GetClientRect( &rectWnd);
    ilOverlayImage(m_ImgId, rectWnd.left ,rectWnd.top , 0);

     

  • Anonymous
    2010-08-10

    ok I just found this on the tutorial on wiki.
    "To compile under Windows using MSVC you'll need to create new Win32 Application project and add DevIL.lib, OpenGL32.lib, SDLmain.lib and SDL.lib into link section in project's settings. "

    What are SDLmain.llib and SDL.lib? Are these needed for windows app? where do you get them?