Note that there are some explanatory texts on larger screens.

plurals
  1. POWhole screen capture and render in DirectX [PERFORMANCE]
    primarykey
    data
    text
    <p>I need some way to get screen data and pass them to DX9 surface/texture in my aplication and render it at at least <strong>25fps</strong> at <strong>1600*900</strong> resolution, 30 would be better.</p> <p>I tried BitBliting but even after that I am at 20fps and after loading data into texture and rendering it I am at 11fps which is far behind what I need.</p> <p>GetFrontBufferData is out of question.</p> <p><strong><a href="http://www.codeproject.com/Articles/5051/Various-methods-for-capturing-the-screen#Windows%20Media%20API%20for%20Capturing%20the%20Screen%20%3a">Here</a></strong> is something about <strong>using Windows Media API</strong>, but I am not familiar with it. Sample is saving data right into file, maybe it can be set up to give you individual frames, but I haven't found good enough documentation to try it on my own.</p> <p>My code:</p> <pre><code>m_memDC.BitBlt(0, 0, m_Rect.Width(),m_Rect.Height(), //m_Rect is area to be captured &amp;m_dc, m_Rect.left, m_Rect.top, SRCCOPY); //at 20-25fps after this if I comment out the rest //DC,HBITMAP setup and memory alloc is done once at the begining GetDIBits( m_hDc, (HBITMAP)m_hBmp.GetSafeHandle(), 0L, // Start scan line (DWORD)m_Rect.Height(), // # of scan lines m_lpData, // LPBYTE (LPBITMAPINFO)m_bi, // address of bitmapinfo (DWORD)DIB_RGB_COLORS); // Use RGB for color table //at 17-20fps IDirect3DSurface9 *tmp; m_pImageBuffer[0]-&gt;GetSurfaceLevel(0,&amp;tmp); //m_pImageBuffer is Texture of same //size as bitmap to prevent stretching hr= D3DXLoadSurfaceFromMemory(tmp,NULL,NULL, (LPVOID)m_lpData, D3DFMT_X8R8G8B8, m_Rect.Width()*4, NULL, &amp;r, //SetRect(&amp;r,0,0,m_Rect.Width(),m_Rect.Height(); D3DX_DEFAULT,0); //12-14fps IDirect3DSurface9 *frameS; hr=m_pFrameTexture-&gt;GetSurfaceLevel(0,&amp;frameS); // Texture of that is rendered pd3dDevice-&gt;StretchRect(tmp,NULL,frameS,NULL,D3DTEXF_NONE); //11fps </code></pre> <p>I found out that for 512*512 square its running on 30fps (for i.e. 490*450 at 20-25) so I tried dividing screen, but it didn't seem to work well.</p> <p>If there is something missing in code please write, don't vote down. Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload