Jump to content
  • Advertisement
Sign in to follow this  

D3DXLoadSurfaceFromResource and PNG files

This topic is 1936 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 guys


I have run into a bit of a problem where my attempts to load a Offscreen Plain surface from a resource are always met with a result of D3DXERR_INVALIDDATA.


The actual file format is png, the resource type in the RC file is RT_RCDATA, and the surface is created using CreateOffscreenPlainSurface using D3DFMT_A8R8G8B8 and D3DPOOL_DEFAULT.


Here is one of my D3DXLoadSurfaceFromResource functions:




hr = D3DXLoadSurfaceFromResource(mvnl->mTop, NULL, NULL, 


I have made sure that the surface pointer is not NULL, and the module instance is also not NULL. Im starting to wonder if there is not possibly a incompatibility with PNG files and LoadSurfaceFromResource. Or would it be a case of PNG files not being 32bitARGB? 





Share this post

Link to post
Share on other sites

I remember I couldn't get D3DXLoadSurfaceFromResource() to work either. I believe the function simply couldn't find the specified resource. Try accessing the resource with the FindResource, LoadResource, LockResource API functions and then loading it with D3DXLoadSurfaceFromMemory().

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.

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!