Menu

Program Will Not Load Image

2003-04-16
2003-04-17
  • Nobody/Anonymous

    No matter what I do, I cannot get this program to load an image. Here is the source code:

    #ifdef  _DEBUG
    #define IL_DEBUG
    #endif//_DEBUG

    #include windows.h (Took out <>'s)
    #include stdio.h
    #include stdlib.h
    #include IL/il.h
    #include IL/ilu.h
    #include IL/ilut.h

    int main(int argc, char **argv)
    {
        // Initialize DevIL
        ilInit();
        iluInit();
        ilutRenderer(ILUT_WIN32);
        ILuint Undos;
        ilGenImages(1, &Undos);
        ilBindImage(Undos);
        if (ilLoadImage("Ducky.gif"))
        {
            printf("Got here.\n");
            ilutRenderer(ILUT_WIN32);
        }

    }

     
    • Nobody/Anonymous

      It is not just when using a .gif file, I have also tried .jpg's.

       
    • Martin Slater

      Martin Slater - 2003-04-17

      What error do you get back. The code below is what i use to dump the error.

      void print_il_error(void)
      {
          ILenum error = ilGetError();

          switch(error) {
              case IL_NO_ERROR :
                  printf("No detectable error has occured. \n"); break;
              case IL_INVALID_ENUM  :
                  printf("An unacceptable enumerated value was passed to a function. \n"); break;
              case IL_OUT_OF_MEMORY :
                  printf("Could not allocate enough memory in an operation. \n"); break;
              case IL_FORMAT_NOT_SUPPORTED :
                  printf("The format a function tried to use was not able to be used by that function. \n"); break;
              case IL_INTERNAL_ERROR :
                  printf("A serious error has occurred. Please e-mail DooMWiz with the conditions leading up to this error being reported. \n"); break;
              case IL_INVALID_VALUE :
                  printf("An invalid value was passed to a function or was in a file. \n"); break;
              case IL_ILLEGAL_OPERATION :
                  printf("The operation attempted is not allowable in the current state. The function returns with no ill side effects. \n"); break;
              case IL_ILLEGAL_FILE_VALUE :
                  printf("An illegal value was found in a file trying to be loaded. \n"); break;
              case IL_INVALID_FILE_HEADER :
                  printf("A file's header was incorrect. \n"); break;
              case IL_INVALID_PARAM :
                  printf("An invalid parameter was passed to a function, such as a NULL pointer. \n"); break;
              case IL_COULD_NOT_OPEN_FILE :
                  printf("Could not open the file specified. The file may already be open by another app or may not exist. \n"); break;
              case IL_INVALID_EXTENSION :
                  printf("The extension of the specified filename was not correct for the type of image-loading function. \n"); break;
              case IL_FILE_ALREADY_EXISTS :
                  printf("The filename specified already belongs to another file. To overwrite files by default, call ilEnable with the IL_FILE_OVERWRITE parameter. \n"); break;
              case IL_OUT_FORMAT_SAME :
                  printf("Tried to convert an image from its format to the same format. \n"); break;
              case IL_STACK_OVERFLOW :
                  printf("One of the internal stacks was already filled, and the user tried to add on to the full stack. \n"); break;
              case IL_STACK_UNDERFLOW :
                  printf("One of the internal stacks was empty, and the user tried to empty the already empty stack. \n"); break;
              case IL_INVALID_CONVERSION :
                  printf("An invalid conversion attempt was tried. \n"); break;
              case IL_LIB_JPEG_ERROR :
                  printf("An error occurred in the libjpeg library. \n"); break;
              case IL_LIB_PNG_ERROR :
                  printf("An error occurred in the libpng library. \n"); break;
              case IL_UNKNOWN_ERROR :
                  printf("No function sets this yet, but it is possible (not probable) it may be used in the future. \n"); break;
              case ILUT_NOT_SUPPORTED :
                  printf("A type is valid but not supported in the current build. \n"); break;
              case IL_BAD_DIMENSIONS :
                  printf("Image dimensions are invalid\n"); break;
          }
      }

       

Log in to post a comment.