DirectX SDK

IDirect3D7::CreateDevice

The IDirect3D7::CreateDevice method creates a Direct3D device to be used with the DrawPrimitive methods.

HRESULT CreateDevice(
  REFCLSID rclsid,                    
  LPDIRECTDRAWSURFACE7 lpDDS,         
  LPDIRECT3DDEVICE7 *  lplpD3DDevice,
);

Parameters

rclsid
Class identifier for the new device. This value can be IID_IDirect3DTnLHalDevice, IID_IDirect3DHALDevice, IID_IDirect3DMMXDevice, or IID_IDirect3DRGBDevice. The IID_IDirect3DRampDevice, used for the ramp emulation device, is not supported by interfaces later than IDirect3D2. To use ramp emulation, you must use the legacy IDirect3D2 interface.
lpDDS
Address of the IDirectDrawSurface7 interface for the DirectDrawSurface object that is the device's rendering target. The surface must have been created as a 3-D device by using the DDSCAPS_3DDEVICE capability.
lplpD3DDevice
Address of a pointer to the new IDirect3DDevice7 interface when the method returns.

Return Values

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value is an error. The method returns DDERR_INVALIDPARAMS if one of the arguments is invalid.

Remarks

All rendering devices created by a given Direct3D object share the same physical resources. Although your application can create multiple rendering devices from a single Direct3D object, because they share the same hardware, extreme performance penalties will be incurred.

In the legacy IDirect3D3 interface, this method accepted pointers to the IDirectDrawSurface4 and IDirect3DDevice3 interfaces.

When you call IDirect3D7::CreateDevice, you create a device object that is separate from a DirectDraw surface object. This device uses a DirectDraw surface as a rendering target.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Version: Requires DirectX 7.0.
  Header: Declared in d3d.h.

See Also

IDirect3DDevice7, Creating a Direct3D Device, Direct3D Devices