Archived

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

D3DXLoadSurfaceFromResource

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

Hey in the D3DXLoadSurfaceFromResource function, what should I have for the 4th parameter (hSrcModule)? Do I have to open the resource first? If so, is there a way to load a "homemade" file format? Thanks! - master_ball ---------------------------- We R 138

Share this post


Link to post
Share on other sites
SrcModule is usually NULL, assuming you are accessing a resource compiled into your exe. You don''t need to open the resource before calling D3DXLoadSurfaceFromResource.

I doubt D3DXLoadSurfaceFromResource can help you loading homemade file formats. It would have to be psychic =)

xyzzy

Share this post


Link to post
Share on other sites
Thanks xyzzy00! You''re right I wasn''t thinking there. Suppose I had a file with raw bitmap data, and I''m hardcoding the heighth, width, etc. What would be the best way to load each pixel (24bit) RGB to a D3D surface that had a D3DFMT_X8R8G8B8?


- master_ball

----------------------------
We R 138

Share this post


Link to post
Share on other sites
If you have a pointer to your surface data in D3DFMT_R8G8B8 format.. you can use D3DXLoadSurfaceFromMemory to load it into your D3DFMT_X8R8G8B8 surface. You still need to open your file/resource and parse out the width and height information yourself however, before you call.

xyzzy

Share this post


Link to post
Share on other sites