I really need help for your implementation of D3DM.
HRESULT IDirect3DMobileDevice::GetFrontBuffer( Â IDirect3DMobileSurface* pFrontBuffer );
But MS one is like:
HRESULT IDirect3DMobileDevice::GetFrontBuffer( Â IDirect3DMobileSurface** pFrontBuffer );
How I can handle this difference?
And one more question.
I need to implement glReadPixels for one pixel. How can I achive it with your realization of D3DM? If I try to get and lock backbuffer, i get it with compressed data. And (as I realized from your header) it decompress automatically after Unlocking. But the memory pointed by pBits is already unaccessible for that moment.
Or if it will be more appropriate for you, just give me source of D3DMPCViewer.lib. That way I'll try to solve that problems by myself and then to give some feedback to you.
I assume you’re looking at the MSDN documentation for D3DM? It does indeed have two *'s there, but in the D3DM.h file it has a single * - our header matches the header from the MS Platform SDK. It appears to be a documentation error on MS’s part.
I don’t really follow your second question. What do you mean by compressed data? If you lock a render target you’ll get the real data, most likely in either 16-bpp or 32-bpp format; you’ll need to query for the surface format to understand the data.
I think that your GetFrontBuffer realised as one ohter method from D3D9 called GetFrontBufferData.
In your version of d3dm.h we can see bool bDecompress member.
IDirect3DMobileSurface ... {
...
// Data to handle auto-decompression of funky formats: D3DMFORMAT Format; bool bDecompress; // <- THIS ONE IDirect3DSurface9 *pC; // If the format is a compressed texture, we'll Lock/Unlock this one, and decompress into the real one at unlock. D3DMLOCKED_RECT lockData; RECT Rect;
};
And when I lock backbuffer that member bDecompress is set to true, and buffer is almost full of zeroes except several bytes in the beginning of pBits pointed memory.
Then, in the process of relesing, feq second takes to decompress (I tought) some data. But the data is still unreachable.
To check the real backbuffer content I've rewritten piece of code with directly access to D3D9 device and D3DSurface9, and it work almost as I expect, but not fully as I expect. And the backbuffer is not empty or filled with zeroes.
What can I try in context of D3DM and without hacks?