Platform SDK: DirectX |
The D3DXCreateContext function initializes the specified device.
HRESULT D3DXCreateContext( DWORD deviceIndex, DWORD flags, HWND hwnd, DWORD width, DWORD height, LPD3DXCONTEXT* ppCtx );
If the function succeeds, the return value is S_OK.
If the function fails, the return value may be one of the following values:
If your application is operating in windowed mode, hwnd must be a valid window (it cannot be NULL or D3DX_DEFAULT). Also, if either width or height is D3DX_DEFAULT, both values default to the dimensions of the client area of hwnd.
If your application is operating in full-screen mode, hwnd must be a valid window (it cannot be NULL or D3DX_DEFAULT). Also, if either width or height is D3DX_DEFAULT, width defaults to 640 pixels, and height defaults to 480 pixels.
If your application is operating in off-screen mode: hwnd must be NULL or D3DX_DEFAULT. An error is returned if either width or height is D3DX_DEFAULT.
The D3DXCreateContext function is the simplest Direct3DX initialization function available. Parameters are treated the same as the matching subset of parameters in the D3DXCreateContextEx function. The D3DXCreateContextEx parameters not present in the D3DXCreateContext function are treated as D3DX_DEFAULT.
Note Multiple monitor systems are not supported by contexts created with the D3DXCreateContext function. For multiple monitor support, see the D3DXCreateContextEx function.
As with any function, you should not expect D3DXCreateContext to be fail-safe. Supported device capabilities should be used as a guide for choosing parameter values. Inevitably, there will be some combinations of parameters that do not work.
The default projection matrix setup by the D3DXCreateContext function is a left-handed perspective projection with a field-of-view (fov) of pi/2 radians.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Version: Requires DirectX 7.0.
Header: Declared in d3dxcore.h.
Library: Use d3dx.lib.