Platform SDK: DirectX |
This section pertains only to application development in Visual Basic. See DirectDraw C/C++ Tutorials.
A display mode is a hardware setting that describes the dimensions and bit-depth of graphics that the display hardware sends to the monitor from the primary surface. Display modes are described by their defining characteristics: width, height, and bit-depth. For instance, most display adapters can display graphics 640 pixels wide and 480 pixels tall, where each pixel is 8 bits of data. In shorthand, this display mode is called 640×480×8. As the dimensions of a display mode get larger or as the bit-depth increases, more display memory is required.
Support for display modes varies depending on the display adapter. To ensure a particular display mode is supported on the system, you should enumerate all the valid display modes using the DirectDraw7.GetDisplayModesEnum method. This method creates and fills a DirectDrawEnumModes enumeration object called DisplayModesEnum which is then used to retrieve the descriptions of individual display modes.
In the Tutorial 5 sample the methods of the DisplayModesEnum object are called for each supported display mode:
Dim DisplayModesEnum As DirectDrawEnumModes Dim ddsd2 As DDSURFACEDESC2 Dim dd As DirectDraw7 Set dd = m_dx.DirectDrawCreate(sGuid) dd.SetCooperativeLevel Me.hWnd, DDSCL_NORMAL Set DisplayModesEnum = dd.GetDisplayModesEnum(0, ddsd2) OutList.AddItem " Display Modes" For i = 1 To DisplayModesEnum.GetCount() DisplayModesEnum.GetItem i, ddsd2 OutList.AddItem " Index " + Str(i) OutList.AddItem " Width " + Str(ddsd2.lWidth) OutList.AddItem " Height " + Str(ddsd2.lHeight) OutList.AddItem " Bits Per Pixel" + Str(ddsd2.ddpfPixelFormat.lRGBBitCount) OutList.AddItem " Refresh Rate " + Str(ddsd2.lRefreshRate) OutList.AddItem "" Next