このコードは DirectX 9 にあり、COM インターフェイスから DC を取得して描画する必要があります。DC を取得し、画像が含まれていますが、黒い画面が表示されます。理由はありますか?
LPDIRECT3DSURFACE9 pRenderSurface = NULL, pRenderSurfaceTMP = NULL;
m_pRenderTexture->GetSurfaceLevel(0, &pRenderSurface);
if (pRenderSurface == NULL)
return FALSE;
m_pD3DDevice->CreateOffscreenPlainSurface(m_nWidth, m_nHeight,
D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM, &pRenderSurfaceTMP, 0);
m_pD3DDevice->GetRenderTargetData(pRenderSurface,pRenderSurfaceTMP);
HDC hDC = NULL;
hr = pRenderSurfaceTMP->GetDC(&hDC);
if (FAILED(hr))
return FALSE;
if (m_pViewObject != NULL)
{
// RECT is relative to the windowless container rect
RECTL rcRect = {0, 0, m_nWidth, m_nHeight};
// Draw onto the DC!
hr = m_pViewObject->Draw(DVASPECT_CONTENT, 1,
NULL, NULL, NULL, hDC, &rcRect, NULL, NULL,
0);
}
pRenderSurface->ReleaseDC(hDC);
pRenderSurface->Release();
// Draw the surface
m_pD3DDevice->SetStreamSource( 0, m_pVertexBuffer, 0, sizeof(Vertex) );
m_pD3DDevice->SetTexture( 0, m_pRenderTexture );
hr = m_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
m_hbrBackground = NULL;
pRenderSurfaceTMP->Release();
前もって感謝します