Sign in to follow this  
Tispe

[DX9] D3DXCreateTextureFromFileInMemoryEx question

Recommended Posts

Hello, I load a file which contains several dds images.

Does the D3DXCreateTextureFromFileInMemory[b]Ex[/b] argument LPCVOID pSrcData start before or after the header? It is a DXT3 compressed dds image from memory.

I figure since so much of the arguments could be found in the header then my assumption that the header is not needed for this function is correct.

So, D3DXCreateTextureFromFileInMemory[b]Ex[/b]= no header needed?
And D3DXCreateTextureFromFileInMemory[b] = [/b]header needed?

msdn:
[code]
HRESULT D3DXCreateTextureFromFileInMemoryEx(
__in LPDIRECT3DDEVICE9 pDevice,
__in LPCVOID pSrcData,
__in UINT SrcDataSize,
__in UINT Width,
__in UINT Height,
__in UINT MipLevels,
__in DWORD Usage,
__in D3DFORMAT Format,
__in D3DPOOL Pool,
__in DWORD Filter,
__in DWORD MipFilter,
__in D3DCOLOR ColorKey,
__inout D3DXIMAGE_INFO *pSrcInfo,
__out PALETTEENTRY *pPalette,
__out LPDIRECT3DTEXTURE9 *ppTexture
);
[/code]

[i]pSrcData[/i] [in]
Pointer to the file in memory from which to create the texture.

Share this post


Link to post
Share on other sites
The function does require file header data as well.

The rest of the input parameters describe the desired destination texture properties, which may or may not be same as in the original image.Furthermore, the function works with many other formats in addition to DDS, that may not have the same file contents organization.

Share this post


Link to post
Share on other sites
The function doesn't care whether or not the original data is actually read from file or somewhere else, so you could provide your own header and concatenate it with the rest of the data before feeding the memory to it.

More often than not, however, content files in packages (which, I assume, is your scenario here) are actually of varying dimensions and formats. The DDS header isn't exactly huge, and leaving it with each file in memory would make your life easier in the long run.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this