Loading png textures
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?
instead of using glbmp to learn this function, download the original libpng (ie the original, what glbmp uses) and it has a shirt load of examples in it.
Note, you also need zlib for compression.
http://www.libpng.org/
Beer - the love catalyst
good ol'' homepage
Note, you also need zlib for compression.
http://www.libpng.org/
Beer - the love catalyst
good ol'' homepage
Beer - the love catalystgood ol' homepage
I would reccomend useing DevIL for loading images, openil.sourceforge.net
www.EberKain.comThere it is, Television, Look Listen Kneel Pray.
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.
神はサイコロを振らない!
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?
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?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement