Jump to content
  • Advertisement
Sign in to follow this  
dzl

Something wrong while reading PNG images?

This topic is 5405 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

HI,Everyone, I wanan use PNG images in my game, but 'libpng' is too complicated to handle. According to the specification, i am trying to my own simple PNG reader based on the source code of 'libpng' and 'zlib'. When i come to the compressed image bytes, i failed to overwhelm it. No matter the data is coded using Dynamic Huffman Code or Fixed Huffman Code, the last 3 bytes is always skipped. Say, only 361 bytes of 364 are processed. Another problem, the decompressed data always looks like, 1, 255, 0, 0, 0, 0,..., although with different input images. I've been feazed for 5 days, anybody Help! Thanks a lot!

Share this post


Link to post
Share on other sites
Advertisement
To circumvent the problem you could use a library... A good OpenGL one is DevIL at http://openil.sourceforge.net/ works great for me.

It can hide almost all work where you just pass in a string with the filename and it will give you back a GLuint. Or you can write a 5 line function so it will give you mipmapped GLuint.

It can also help you and give you data for DirectX I believe.

Share this post


Link to post
Share on other sites
I had the same frustrations while using zlib and jpeglib. I suggest that you read all documentation and examples that come with the libraries, and then use them to write you class. There is really no point in trying to "re-code" what already works. You will give your self even more headaches doing that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!