D3DXLoadSurfaceFromResource and PNG files

Started by
0 comments, last by eppo 10 years, 10 months ago

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, 
modinst, MAKEINTRESOURCE(400), NULL, D3DX_DEFAULT, D3DCOLOR_ARGB(255,0,0,0), 
&dii);
 

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?

Thanks

JB

Advertisement

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().

This topic is closed to new replies.

Advertisement