This method sets a new color buffer, depth buffer, or both for the device.
HRESULT SetRenderTarget( IDirect3DMobileSurface* pRenderTarget, IDirect3DMobileSurface* pNewZStencil );
[in] Pointer to a new color buffer. If NULL, the existing color buffer is retained. If this parameter is not NULL, the reference count on the new render target is incremented. Devices always have to be associated with a color buffer.
The new render target surface must have at least D3DMUSAGE_RENDERTARGET (see D3DMUSAGE Values) specified.
[in] Pointer to a new depth-stencil buffer. If there is an existing depth-stencil buffer, it is released. If this parameter is not NULL, the reference count on the new depth-stencil buffer surface is incremented. Applications can change the render target without changing the depth buffer by passing in the ppZStencilSurface parameter of IDirect3DMobileDevice::GetDepthStencilSurface.
The new depth-stencil surface must at least have D3DMPOOL_SYSTEMMEM (see D3DMPOOL) specified.
When a color buffer and a depth-stencil surface have been associated with the same device by this method, they are said to be paired.
The previous depth-stencil surface's contents persist after a call to IDirect3DMobileDevice::SetRenderTarget to disassociate the previous depth-stencil surface from the device. If the surface is re-associated with the device, then the contents of the surface will be unchanged — if the color buffer to which the new depth-stencil surface is being paired is the same size and format as the color buffer to which the depth-stencil surface was most recently paired.
Calling this method resets the current viewport of the device to the size of the current render target. This is done regardless of whether the z-buffer is the only one that is being changed.