Home > other >  Direct3D how to obtain the background on the surface of the cache data and copied to the memory
Direct3D how to obtain the background on the surface of the cache data and copied to the memory

Time:09-18

A piece of code on the first
 
//do not use the swap chain:
IDirect3DSurface9 * pBackBuffer;
//the cache after surface
M_pd3dDevice - & gt; GetBackBuffer (0, 0, D3DBACKBUFFER_TYPE_MONO, & amp; PBackBuffer);

//will be saved as a file cache surface after (D3DXIFF_ * to save the image format, BMP, JPG, tga, PNG, DDS, etc.)
D3DXSaveSurfaceToFile (TEXT (" C: \ \ temp. JPG "), D3DXIFF_JPG, pBackBuffer, NULL, NULL);

PBackBuffer - & gt; Release ();

This code was to preserve the background cache surface for a picture, but now I need to save the background on the surface of the cache data to save memory in the form of BYTE (the BYTE data should be a dot matrix diagram), to the other methods to deal with the data. I don't know how to operate, which a man knows how to handle, also please teach next thanked the first,

CodePudding user response:

The RECT the RECT.
//set the width
D3DLOCKED_RECT lockedRect;
PBackBuffer - & gt; LockRect (& amp; LockedRect, & amp; The rect, 0);
XXXX (*) lockedRect. PBits;//the actual data, the specific format and the format
//https://msdn.microsoft.com/en-us/library/bb172570 (v=versus 85). Aspx
PBackBuffer - & gt; UnlockRect ();

CodePudding user response:

BackBuffer cannot be read directly, you need to create a BackBuffer and other large Pool for Managed Texture, then the content of the BackBuffer CopyRect to Texture, and then to Lock the Texture
  • Related