Cómo obtener el contexto del dispositivo en Direct3D10

Could anyone please help me to port this DX9 code to DX10 (not 11!). It is a simple drawing to texture.

    // 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);

Error handling and the likes can be omitted for simplicity.

preguntado el 31 de julio de 12 a las 13:07

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.