首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DevIL错误1290。我怎么才能修复它?

DevIL错误1290。我怎么才能修复它?
EN

Stack Overflow用户
提问于 2011-10-31 03:27:08
回答 1查看 1.6K关注 0票数 0

我想要将图像加载到我的应用程序中,但我有一个错误:http://img510.imageshack.us/img510/5814/blad07864.png

这是这个应用程序的代码:

代码语言:javascript
复制
#include <stdio.h>
#include <stdlib.h>

#undef _UNICODE
#include "il.h"

#pragma comment( lib, "DevIL.lib" )

// Wow. DevIL is amazing.

// From http://gpwiki.org/index.php/DevIL:Tutorials:Basics

// The library consists of three sub-libraries:
//  * IL - main DevIL library. It allows you to load and save images to files. Every function in this library have 'il' prefixed to their name.
//  * ILU - this library contains functions for altering images. Every function in this library have 'ilu' prefixed to their name.
//  * ILUT - this library connects DevIL with OpenGL. Every function in this library have 'ilut' prefixed to their name.

int main()
{
  ilInit();
  printf("DevIL has been initialized\n");

  // Loading an image
  ILboolean result = ilLoadImage( "tex1.png" ) ;

  if( result == true )
  {
    printf("the image loaded successfully\n");
  }
  else
  {
    printf("The image failed to load\n" ) ;

    ILenum err = ilGetError() ;
    printf( "the error %d\n", err );
    printf( "string is %s\n", ilGetString( err ) );
  }

  int size = ilGetInteger( IL_IMAGE_SIZE_OF_DATA ) ;
  printf("Data size:  %d\n", size );
  ILubyte * bytes = ilGetData() ;

  for( int i = 0 ; i < size; i++ )
  {
    // see we should see the byte data of the image now.
    printf( "%d\n", bytes[ i ] );
  }
}

我在这个网站上找到了代码:http://bobobobo.wordpress.com/2009/03/02/how-to-load-a-png-image-in-c/

你能帮帮我吗?

EN

回答 1

Stack Overflow用户

发布于 2011-10-31 04:00:57

根据this post的说法,1290表示找不到图像路径。尝试使用绝对文件路径,然后看看它是否可以加载。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7947243

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档