IDirect3DDevice2::SetCurrentViewport

The IDirect3DDevice2::SetCurrentViewport method sets the current viewport.

HRESULT SetCurrentViewport(
  LPDIRECT3DVIEWPORT2 lpd3dViewport2  
);
 

Parameters

lpd3dViewport2
Address of the viewport that will become the current viewport if the method is successful.

Return Values

If the method succeeds, the return value is DD_OK.

If the method fails, the return value is an error. The method returns DDERR_INVALIDPARAMS if one of the arguments is invalid.

Remarks

Applications must call this method before calling any rendering functions. Before calling this method, applications must have already called the IDirect3DDevice2::AddViewport method to add the viewport to the device.

Before the first call to IDirect3DDevice2::SetCurrentViewport, the current viewport for the device is invalid, and any attempts to render using the device will fail.

This method increases the reference count of the viewport interface specified by the lpd3dViewport2 parameter and releases the previous viewport, if any.

This method was introduced with the IDirect3DDevice2 interface.

QuickInfo

  Windows NT: Use version 5.0 or later.
  Windows: Use Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Header: Declared in d3d.h.
  Import Library: Use ddraw.lib.

See Also

IDirect3DDevice2::GetCurrentViewport