fp.h used by libpng issue
Has anyone who has used libpng experienced the issue that you cannot compile due to fp.h being missing? I searched my hard disk and fp.h only exists in the simulator sdk and not the device sdk. Even if I set my default sdk to simluator it still cannot find fp.h
Also when I run with libpng(by removing the fp.h include and forcing it to use math.h), it works fine on the simulator but it errors out on the device at doing the:
setjmp(png_jmpbuf(png_ptr)
call when setting up a png
If anyone has any thoughts please do share.
Also when I run with libpng(by removing the fp.h include and forcing it to use math.h), it works fine on the simulator but it errors out on the device at doing the:
setjmp(png_jmpbuf(png_ptr)
call when setting up a png
If anyone has any thoughts please do share.
Works great for me. Compiles fine OOTB, runs fine.
Not sure what the problem might be but if you're just loading your PNG files (as opposed to any PNG file) you might want to try a lightweight loader like: http://www.nothings.org/stb_image.c
I need to load any png that I have control over, so if its a format thing I could ensure they are all 24 bit rbga if thats what you mean?
Ya - it can't handle every little quirk of the format but you can easily avoid incompatibilities with your own files.
Thanks ill give that a try
I finally got around to trying this. Worked easily and great on simulator. When I went to device I get very long load times, an almost entirely black screen with 2 white boxes... And then after a bit a crash on some logic that copies an image that stbi gave me into a power of 2 sized array which works fine on the simulator
Code:
unsigned char* pixels = calloc( width2 * height2 * 4, sizeof(unsigned char) );
int rowsize1=width*4;//4 bits per pixel
int actualRowSize1=width*bpp;
int rowsize2=width2*4;
//copy the data to an outer array of the width2,height2 size
for(int i=0;i<height;i++)
{
for(int j=0;j<rowsize1;j++)
{
if(bpp==3)
{
//Here we need hard set the alpha to 255 and take that into account in our index into the source array.
pixels[i*rowsize2+j]=((j+1)%4==0)?255:data[i*actualRowSize1+j-(j/4)];
}
else
{
pixels[i*rowsize2+j]=data[i*rowsize1+j];
}
}
}
Ah nevermind, just had to uncheck compress pngs in the build settings.

