Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Game Boy

Loading png textures

This topic is 6037 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

I''m using Jason Allen''s glBMP image library to load my png textures. Problem is, I want to load the images from a Visual C++ resource instad of from a file. I''ve read about using the png_set_read_fn() function to use an alternate data source but I don''t really get it. Can someone please give me a working example of how to do this?

Share this post


Link to post
Share on other sites
Advertisement

There are some great examples from the original distribution of the libpng library. Grab it at http://www.libpng.org They show how to create your own read and write. I have to do this because I use C++ iostream.

If you mean how to use resources, that''s a whole different matter. Consult a decent Windows programming book.


Premature optimizations can only slow down your project even more.

Share this post


Link to post
Share on other sites
I know how to use resources, I have successfully loaded raw images from a resource to a texture. I use this code to open the resource

HRSRC rsrc = FindResource(NULL,MAKEINTRESOURCE(resid),RT_RCDATA);
HGLOBAL MemoryHandle = LoadResource(NULL, rsrc);
BYTE *picture = (BYTE *)LockResource(MemoryHandle);

But how do I move the data from *picture into a libpng structure?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!