Export (0) Print
Expand All
Expand Minimize

IDirect3DDevice9::SetViewport method

Sets the viewport parameters for the device.

Syntax


HRESULT SetViewport(
  [in]  const D3DVIEWPORT9 *pViewport
);

Parameters

pViewport [in]

Type: const D3DVIEWPORT9*

Pointer to a D3DVIEWPORT9 structure, specifying the viewport parameters to set.

Return value

Type: HRESULT

If the method succeeds, the return value is D3D_OK. If the method fails, it will return D3DERR_INVALIDCALL. This will happen if pViewport is invalid, or if pViewport describes a region that cannot exist within the render target surface.

Remarks

Direct3D sets the following default values for the viewport.



D3DVIEWPORT9 vp;
vp.X      = 0;
vp.Y      = 0;
vp.Width  = RenderTarget.Width;
vp.Height = RenderTarget.Height;
vp.MinZ   = 0.0f;
vp.MaxZ   = 1.0f;


IDirect3DDevice9::SetViewport can be used to draw on part of the screen. Make sure to call it before any geometry is drawn so the viewport settings will take effect.

To draw multiple views within a scene, repeat the IDirect3DDevice9::SetViewport and draw geometry sequence for each view.

Requirements

Header

D3D9.h

Library

D3D9.lib

See also

IDirect3DDevice9
IDirect3DDevice9::GetViewport

 

 

Community Additions

ADD
Show:
© 2014 Microsoft