Fedora Linux Support Community & Resources Center
  #1  
Old 11th August 2004, 03:26 PM
PompeyBlue's Avatar
PompeyBlue Offline
Registered User
 
Join Date: Jun 2004
Location: Portsmouth, UK
Posts: 444
libpng.so and reading .png images

Ok,

This is mega specialist, so I won't expect any replies, but I'll ask anyway

So if I use KPaint and examine a .png image it reports it's stats as:

128x128 24bpp

However, if I then use libpng.so to load this (using the sample code) and then look at the header (info_ptr) it reports:

width: 128 (fine)
height: 128 (fine)
rowbytes: 384 (fine i.e. 128 * 3 = 384)
bit_depth: 8 (what ? I thought it was 24bpp or 3 bytes)
valid: 32768 (I presume this is unpacked size which seems to small since 128 * 3 * 128 = 49152)

Has anybody used this before ? Maybe the .png I'm reading is fine, it's just when I try and texture with it using opengl it's colours are all washed out and it's at 45 degrees.
Reply With Quote
  #2  
Old 11th August 2004, 04:39 PM
PompeyBlue's Avatar
PompeyBlue Offline
Registered User
 
Join Date: Jun 2004
Location: Portsmouth, UK
Posts: 444
Eureka

I had presumed that the PNG was read into linear memory, it appears it is not. You must index into the row_pointer that you get given back, and build up the linear version ready for use.

Top, OpenGL texture mapping up and running, reading PNG's

I just need to write the rest of the game code now *gulp*
Reply With Quote
  #3  
Old 12th August 2004, 05:58 AM
Bana's Avatar
Bana Offline
Retired Community Manager
 
Join Date: Feb 2004
Location: Austin, Texas
Age: 26
Posts: 581
Quote:
bit_depth: 8 (what ? I thought it was 24bpp or 3 bytes)
As far as I remember it, it is 3 channels of 8bits each (3*8=24 )

On a broader note: learning OpenGL and libpng etc.. is a great way of understanding the fundamentals of game programming although one of the critical components of OpenSource is the reusability of code. If I could point you in the direction of Ogre, it is an OpenSource 3d graphics library specifically for games. It is quite spectacular, just look at this screenshot: http://ogre.sourceforge.net/albums/a...ake3.sized.jpg
To copy and paste off the website:
Quote:
What is OGRE?

OGRE (Object-Oriented Graphics Rendering Engine) is a scene-oriented, flexible 3D engine written in C++ designed to make it easier and more intuitive for developers to produce applications utilising hardware-accelerated 3D graphics. The class library abstracts all the details of using the underlying system libraries like Direct3D and OpenGL and provides an interface based on world objects and other intuitive classes.
And from another post I have in this forum (sorry to copy paste but I liked the format ):

I would suggest the following:You can start right off the bat with these two tools alone to make some pretty cool stuff. Just look at the screenshots on Ogre's website if you are in doubt. And then when you are ready to move onto other areas you can add in Raknet for networking, OpenAL for sound, ODE for collision detection and physics, Crazy Eddies GUI for ingame interface etc... The possibilites are endless. If you have any questions, feel free to pm me.
__________________
http://coolhands.blogspot.com/
binarybana AT gmail.com
Reply With Quote
  #4  
Old 12th August 2004, 11:54 AM
PompeyBlue's Avatar
PompeyBlue Offline
Registered User
 
Join Date: Jun 2004
Location: Portsmouth, UK
Posts: 444
Thanks

Thanks for the replies!

Somebody had mentioned the Ogre3d engine, but I'm really keen on finding out what goes on under the hood. I still don't truly get how the whole API -> OS -> Driver -> GFX CARD pipeline works.
Reply With Quote
Reply

Tags
images, libpngso, png, reading

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help rpm install libpng aloneattack Installation and Live Media 2 9th July 2007 05:23 PM
zlib/libpng license GPL compatible? Conquistador Linux Chat 2 11th January 2006 11:11 PM
problema with libpng and libpng-dev karthikeyan Using Fedora 1 25th August 2005 11:54 AM
libpng.so.3 missing Knudson Using Fedora 5 19th July 2005 07:22 PM


Current GMT-time: 12:21 (Wednesday, 22-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat