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.

Franky Rivera
  • 553
  • 8
  • 20
  • i also just tested to see if i can load another image format my test subject was a ".bmp" and that load didn't give me any errors – Franky Rivera Nov 14 '12 at 11:13

1 Answers1

0

A common reason for ilLoad() to fail with IL_OUT_OF_MEMORY is simply if the PNG file you're using is corrupt.

However, 1285 means IL_INVALID_VALUE - it means the path you're giving it is likely wrong. Try an absolute path (remembering that back slashes aren't okay in C++ unless you use double slashes).

I personally have used DevIL for quite some time and did like it. However, I urge you to consider FreeImage. It has a bit more development going on and is quite stable - I used it in a commercial engine for all my image needs, and it integrates decently well with DirectX/OpenGL much like DevIL.

Mike Weir
  • 3,094
  • 1
  • 30
  • 46