Create a surface with iDirect3dsurface9 and make it red

 Device->BeginScene(); // assume _surface is a pointer to an idirect3dsurface9 interface. // assumes a 32-bit pixel format for each pixel. // get the surface description.Describe the surface D3DSURFACE_DESC surfacedesc; Device->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&_surface); _surface->GetDesc(&surfacedesc);//Note that it has been assumed that _surface is a pointer to the port of idirect3dsurface9// / get a pointer to the surface pixel data. Get the pointer to the memory area D3DLOCKED_RECT lockedrect; _surface->LockRect( &lockedrect, // pointer to receive locked data points to the applied memory area 0, // lock entire surface 0); // no lock flags specified // iterate through each pixel in the surface and set it to red. DWORD * imagedata = (DWORD *)lockedrect.pBits; for(int i = 0; i UnlockRect(); Device->EndScene(); 
 d3dpp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; // d3dpp is the key of the D3DPRESENT_PARAMETERS structure variable.

The above is the main code. Implemented using directx 9.0. At that time, I explored for a long time, and it took a long time. .

Thanks to these two friends for their blogs

IDirect3DSurface9::LockRect failed

< p>Directx IDirect3DSurface9:LockRect call returns a negative number with a very large absolute value

Welcome to communicate.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1533 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.