Microsoft DirectX 8.1 (Visual Basic) |
The only requirement for configuring the viewport parameters for a rendering device is to set the viewport's clipping volume. To do this, you initialize and set clipping values for the clipping volume and for the render-target surface. Viewports are commonly set up to render to the full area of the render-target surface, but this isn't a requirement.
The only requirement for configuring the viewport parameters for a rendering device is to set the viewport's clipping volume. To do this, you initialize and set clipping values for the clipping volume and for the render-target surface. Viewports are commonly set up to render to the full area of the render-target surface, but this isn't a requirement.
The following Microsoft® Visual Basic® code creates settings in a D3DVIEWPORT8 type to achieve this.
Dim viewData As D3DVIEWPORT8 With viewData .x = 0: .y = 0 .Width = Width: .Height = Height .MinZ = 0#: .MaxZ = 1# End With
After setting values in the D3DVIEWPORT8 type, apply the viewport parameters to the device by calling its Direct3DDevice8.SetViewport method.
' The d3dDevice variable contains a valid reference to a ' Direct3DDevice8 object. Call d3dDevice.SetViewport(viewData)
After the call, the viewport parameters are set and will take effect the next time a rendering method is called. To make changes to the viewport parameters, just update the values in the D3DVIEWPORT8 type and call SetViewport again.