Platform SDK: DirectX

Step 2.1: Retrieve the Render Target

[Visual Basic]

The information in this section pertains only to applications written in C and C++. See Direct3D Immediate Mode Visual Basic Tutorials.

[C++]

At this point, you need to retrieve the device's render target, so that you can use the render target to get a pointer to a DirectDraw object. Then, you need to retrieve the DirectDraw interface, so that you can create a surface.

    LPDIRECTDRAWSURFACE7 pddsRender;
    LPDIRECTDRAW7        pDD;
    pd3dDevice->GetRenderTarget( &pddsRender );
    pddsRender->GetDDInterface( (VOID**)&pDD );
    pddsRender->Release();

The preceding code uses the IDirect3DDevice7::GetRenderTarget method to retrieve a pointer to the DirectDraw surface that is being used as a render target. Then, the IDirectDrawSurface7::GetDDInterface method is used to retrieve an interface to the DirectDraw object that was used to create the render target surface.

After retrieving the render target and a pointer to the DirectDraw interface, you can create the surface for your texture. This is explained in Step 2.2: Create the New Surface.