Adding a Viewport to a Device

After creating a viewport, you can call the IDirect3DDevice3::AddViewport method to add it to the device's viewport list. The following example shows what this call might look like:

    HRESULT hr;
 
    // lpD3DDevice3 is a valid pointer to a Direct3D
    // device object.
    hr = lpD3DDevice3->AddViewport(lpD3DViewport3);
 
    if(FAILED(hr))
        return hr;
    else
    {
      // Set the viewport properties.
    }
 

Once you've added the viewport to the device, you can set the viewport clipping volume. For more information, see Setting the Viewport Clipping Volume.