This method creates a device to represent the display adapter.
HRESULT CreateDevice( UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice8** ppReturnedDeviceInterface );
[in] Ordinal number that denotes the display adapter. D3DADAPTER_DEFAULT is always the primary display adapter.
[in] Member of the D3DDEVTYPE enumerated type. Denotes the desired device type. If the desired device type is not available, the method will fail.
[in] Window handle to which focus belongs for this Microsoft® Direct3D® device. The window specified must be a top-level window for full-screen.
[in] Combination of one or more flags that control global behaviors of the Direct3D device. The following table shows these flags.
Flag Description D3DCREATE_FPU_PRESERVE Indicates that the application needs either double precision FPU or FPU exceptions enabled. Direct3D sets the FPU state each time it is called. Setting the flag will reduce Direct3D performance. This flag can only be set for platforms running on x86 processors. D3DCREATE_HARDWARE_VERTEXPROCESSING Specifies hardware vertex processing. D3DCREATE_MIXED_VERTEXPROCESSING Specifies mixed (both software and hardware) vertex processing. D3DCREATE_MULTITHREADED Indicates that the application requests Direct3D to be multithread safe. This makes Direct3D take its global critical section more frequently, which can degrade performance. D3DCREATE_PUREDEVICE Specifies that Direct3D does not support Get* calls for anything that can be stored in state blocks. It also tells Direct3D not to provide any emulation services for vertex processing. This means that if the device does not support vertex processing, then the application can use only post-transformed vertices. D3DCREATE_SOFTWARE_VERTEXPROCESSING Specifies software vertex processing.
[in, out] Pointer to a D3DPRESENT_PARAMETERS structure, describing the presentation parameters for the device to be created. Calling CreateDevice can change the value of the BackBufferCount member of D3DPRESENT_PARAMETERS; the back buffer count is changed to reflect a corrected number of back buffers.
[out, retval] Address of a pointer to the returned IDirect3DDevice8 interface, representing the created device.
If the method succeeds, the return value is D3D_OK.
If the method fails, the return value can be one of the following values:
This method returns a fully working device interface, set to the required display mode (or windowed), and allocated with the appropriate back buffers. The application only needs to create and set a depth buffer, if desired, to begin rendering.
This method should not be executed during the handling of WM_CREATE. Therefore, the application should never pass a window handle to Direct3D while handling WM_CREATE. DirectX 8.0 applications can expect messages to be sent to them during this call — that is, before this call is returned. Applications should take precautions not to call into Direct3D at this time. In addition, note that a call to create, release, or reset the device can only happen on the same thread as the window procedure of the focus window.
Note that D3DCREATE_HARDWARE_VERTEXPROCESSING, D3DCREATE_MIXED_VERTEXPROCESSING, and D3DCREATE_SOFTWARE_VERTEXPROCESSING are mutually exclusive flags, and that at least one of these vertex-processing flags must be specified when calling CreateDevice.
Back buffers created as part of the device are only lockable if D3DPRESENTFLAG_LOCKABLE_BACKBUFFER is specified in the presentation parameters. (Multisampled back buffers and depth-surfaces are never lockable.)
OS Versions: Windows CE .NET 4.0 and later.
Link Library: D3d8.lib.
Last updated on Thursday, April 08, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.