2

I'm Having an issue with loading an image with devIL for openGL

in an earlier part of my project i call

ilInit();

in a function right after i call my load just like this

//generate a texture
ilGenImages( 1, &uiTextureHandle );

//bind our image
ilBindImage( uiTextureHandle );

//load
//ilLoad( IL_PNG, (const ILstring)"fake.png" );
ilLoad( IL_PNG, "fake.png" );

for the sake of error tracking i did place "ilGetError()" after every call which returned 0 for all of these except for ilLoad which returns 1285

after some searching i figured out that this is a lack of memory error.

so ilLoad always returns 0 and not loaded.

anyone know what im doing incorrect as for my loading or if i forgot to do something because i feel i might have forgotten something and thats the reason why 1285 appears.

4

1 回答 1

0

ilLoad()失败的一个常见原因IL_OUT_OF_MEMORY是您使用的 PNG 文件已损坏。

但是, 1285 意味着IL_INVALID_VALUE- 这意味着您提供的路径可能是错误的。尝试使用绝对路径(请记住,反斜杠在 C++ 中是不行的,除非您使用双斜杠)。

我个人使用 DevIL 已经有一段时间了,并且确实喜欢它。但是,我敦促您考虑 FreeImage。它正在进行更多开发并且非常稳定 - 我在商业引擎中使用它来满足我所有的图像需求,并且它与 DirectX/OpenGL 很好地集成,就像 DevIL 一样。

于 2013-08-04T14:45:57.643 回答