IDirect3DDevice3::SetCurrentViewport

The IDirect3DDevice3::SetCurrentViewport method sets the current viewport.

HRESULT SetCurrentViewport(
  LPDIRECT3DVIEWPORT3 lpd3dViewport  
);
 

Parameters

lpd3dViewport
Address of the IDirect3DViewport3 interface for the viewport that will become the current viewport if the method is successful.

Return Values

If the method succeeds, the return value is D3D_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 IDirect3DDevice3::AddViewport method to add the viewport to the device.

Before the first call to IDirect3DDevice3::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 lpd3dViewport parameter and releases the previous viewport, if any.

This method was introduced with the IDirect3DDevice2 interface. In the IDirect3DDevice2 interface, this method accepts a pointer to an IDirect3DViewport interface, not an IDirect3DViewport3 interface.

QuickInfo

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in d3d.h.
  Import Library: Use ddraw.lib.

See Also

IDirect3DDevice3::GetCurrentViewport