iDevGames Forums
How do you load PNGs on a C++ program? - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: How do you load PNGs on a C++ program? (/thread-661.html)



How do you load PNGs on a C++ program? - riruilo - Oct 20, 2009 08:33 AM

Hi friends!


How do you load PNGs on a C++ program? Now I'm using LodePNG and it seems a bit slow. And if I use PVR it loads ultrafast, but quality is very bad (2d platform game).

I'd like to hear your suggestions about loading PNG files in C++ case (not ObjC).

Thanks.


How do you load PNGs on a C++ program? - warmi - Oct 20, 2009 08:42 AM

Google for C++ image libraries ... there are quite a few.

Personally, I wrap everything in PVR files ( which can store uncompressed images as well).


How do you load PNGs on a C++ program? - AnotherJake - Oct 20, 2009 09:08 AM

Try SOIL!

I haven't actually tried it on iPhone, but I bet it'd work.


How do you load PNGs on a C++ program? - ThemsAllTook - Oct 20, 2009 10:24 AM

I use libpng. (C API, but equally applicable to C++)


How do you load PNGs on a C++ program? - riruilo - Oct 20, 2009 10:50 AM

warmi Wrote:Google for C++ image libraries ... there are quite a few.

Personally, I wrap everything in PVR files ( which can store uncompressed images as well).

I already did that, but result in a 2d platform game is horrible.

See this pictures. 1st uses PVR. 2nd uses PNG.
[Image: img0008gj.png]
[Image: img0043yr.png]


I also tried SOIL but it does not compile for iphone, there are too much errors.


"PVR files ( which can store uncompressed images as well)."
Mmmm.. Warmi , what do you think if I store my pngs inside a pvr? is it at least faster to load?
Can I use
RGBA 4444
RGB 565 in my PVR loader?


How do you load PNGs on a C++ program? - warmi - Oct 20, 2009 11:53 AM

riruilo Wrote:I already did that, but result in a 2d platform game is horrible.

See this pictures. 1st uses PVR. 2nd uses PNG.
[Image: img0008gj.png]
[Image: img0043yr.png]


I also tried SOIL but it does not compile for iphone, there are too much errors.


"PVR files ( which can store uncompressed images as well)."
Mmmm.. Warmi , what do you think if I store my pngs inside a pvr? is it at least faster to load?
Can I use
RGBA 4444
RGB 565 in my PVR loader?

That's what I am doing ... the only downside is that uncompressed images are stored within PVRs well ... uncompressed ,which means a png which weights at 40 kb, will take 80 kb or so when stored within an uncompressed PVR file.

I get around that by having all my game data reside in a virtual file system within a zip file and it only matters in terms of disk storage because once the image gets loaded into an OpenGL buffer it doesn't matter.


How do you load PNGs on a C++ program? - Frank C. - Oct 20, 2009 01:27 PM

riruilo Wrote:I also tried SOIL but it does not compile for iphone, there are too much errors.
I use SOIL's little brother STBI on the iPhone. Works great, but with either of these you need to configure them to exclude stuff that you don't need.

As far as slow-to-load goes, make sure you check load times on release builds. Debug builds can easily be 2X-3X slower for this sort of thing.


How do you load PNGs on a C++ program? - AnotherJake - Oct 20, 2009 01:43 PM

Frank C. Wrote:I use SOIL's little brother STBI on the iPhone. Works great, but with either of these you need to configure them to exclude stuff that you don't need.

Hey, cool, thanks I didn't know about that one! Smile


How do you load PNGs on a C++ program? - miketucker - Oct 20, 2009 05:20 PM

i'd recommend openframeworks... super lightweight framework with a similar style to Processing..

http://www.openframeworks.cc/

loading PNGS, Gifs, JPGS, all super easy and one line of code..