谁能帮我将此DX9代码移植到DX10(不是11!)。这是一个简单的纹理绘图。
// create the texture
m_pDevice->CreateTexture(m_width, m_height, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &m_pTexture, NULL);
// get its surface (target surface)
m_pTexture->GetSurfaceLevel(0, &m_pSurface);
// create the second surface (source surface)
m_pDevice->CreateOffscreenPlainSurface(m_width, m_height, D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM, &m_pSurfaceMem, NULL);
// drawing to Direct3D, this is called in loop
...
m_pSurfaceMem->GetDC(&hdc);
HRGN hrgn = CreateRectRgnIndirect(lprc);
SelectClipRgn(hdc, hrgn);
RECTL clipRect = { 0, 0, m_width, m_height };
// This draws to the source surface
m_pViewObject->Draw(DVASPECT_TRANSPARENT, 1, NULL, NULL, NULL, hdc, &clipRect, &clipRect, NULL, 0);
m_pSurfaceMem->ReleaseDC(hdc);
DeleteObject(hrgn);
POINT pt = {lprc->left, lprc->top};
// Now update the target surface
m_pDevice->UpdateSurface(m_pSurfaceMem, lprc, m_pSurface, &pt);
为简单起见,可以省略错误处理等。