Game Development Reference
In-Depth Information
PresentationInterval
—A member of the
D3DPRESENT
set.
See the documentation for a complete list of valid intervals. Two
common ones are:
D3DPRESENT_INTERVAL_IMMEDIATE
—Presents
immediately
D3DPRESENT_INTERVAL_DEFAULT
—Direct3D will choose
the present rate. Usually this is equal to the refresh rate.
An example of filling this structure out is:
D3DPRESENT_PARAMETERS d3dpp;
d3dpp.BackBufferWidth = 800;
d3dpp.BackBufferHeight = 600;
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8; //pixel format
d3dpp.BackBufferCount = 1;
d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
d3dpp.MultiSampleQuality = 0;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow = hwnd;
d3dpp.Windowed = false; // fullscreen
d3dpp.EnableAutoDepthStencil = true;
d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8; // depth format
d3dpp.Flags = 0;
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
d3dpp.PresentationInterval
= D3DPRESENT_INTERVAL_IMMEDIATE;
1.4.4
Creating the IDirect3DDevice9 Interface
With the
D3DPRESENT_PARAMETERS
filled out, we can create the
IDirect3DDevice9
object with the following method:
HRESULT IDirect3D9::CreateDevice(
UINT Adapter,
D3DDEVTYPE DeviceType,
HWND hFocusWindow,
DWORD BehaviorFlags,
D3DPRESENT_PARAMETERS *pPresentationParameters,
IDirect3DDevice9** ppReturnedDeviceInterface
);
Adapter
—Specifies the physical display adapter that we want the
created
IDirect3DDevice9
object to represent
DeviceType
—Specifies the device type to use (e.g., hardware
device (
D3DDEVTYPE_HAL
) or software device (
D3DDEVTYPE_
REF
))
hFocusWindow
—Handle to the window that the device will be
associated with. This is typically the window that the device will
draw onto, and for our purposes it is the same handle that we spec-
ify for the data member
d3dpp.hDeviceWindow
of the
D3DPRESENT_PARAMETERS
structure.
Search WWH ::
Custom Search