Problem loading large png files?

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Quall
Posts: 154
Joined: Mon Mar 07, 2005 10:16 pm

Problem loading large png files?

Post by Quall »

I believe this may be a bug with the png image loader. I am creating my menus and all png's that I have been working with seemed to load flawlessly. However, I decided to make a rather large overlay. The png image resolution is 1024x512.

If I try to load a bitmap or jpeg in that size, the image seems to load correctly into the gui environment. However, I replaced it with a png and now the app crashes. I do a check to see if the texture itself is loaded, it does not. It is as if the png file is not in the directory(yes it Is, so please don't say that I named it wrong or something like that. I deserve more credit than that). I have tried multiple files in multiple areas of my code.

I have also tried draw2dimage with the driver, with the same result. A check to see if the image is loaded fails. The png file is about 90kb, which I would prefer to use over the 2mb tga and bitmap files. Also to mention, transparency with png images are far easier to do than bitmaps.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Have you tried looking at the debug spew or stepping into the call to getImage that fails. It might give you an idea why the failure is happening.

I was able to download several png images that the loader won't load, but every one of them gives me a reaasonable error message. I had no problem loading a 1152x864 png image.

I would look into where the crash is occuring. Is it crashing because someone decided to use a null texture pointer after the image failed to load?

Travis
Quall
Posts: 154
Joined: Mon Mar 07, 2005 10:16 pm

Post by Quall »

i will try stepping when I get home, but the crash is due to the null pointer. I had a check to see if the pointer was true or not, but I removed it to see if the image was even being loaded (because it wasn't showing up). It crashed, I went to debug it, and it lead me to the null pointer.

I took the png that I was trying to load, cropped half out to a 512x512 image and it loaded fine. I will look into it more when I get home.
MattyBoy
Posts: 19
Joined: Fri Oct 24, 2003 3:07 pm

Post by MattyBoy »

I had the same problem. Seems Irrlicht doesn't like PNG's with 1024 width.

In file CImageLoadedPNG.cpp, around line 205

Original

if( bytes_per_row >= (int)sizeof( g_png_load_buffer ) )

TO

if( bytes_per_row > (int)sizeof( g_png_load_buffer ) )
Quall
Posts: 154
Joined: Mon Mar 07, 2005 10:16 pm

Post by Quall »

thanks, I was going crazy.
Eternl Knight
Posts: 313
Joined: Tue Nov 01, 2005 5:01 am

Post by Eternl Knight »

Nice catch, MattyBoy. I know I'm going to have to change that as I frequently use 4096x4096 textures for some of my work (both for terrains & for more "specialized" uses of image files).

Thanks for this.

--EK
Post Reply