Game Development Reference
In-Depth Information
Thoughts for SDI and MDI Applicability
There are two common windowing modes for a Windows application: SDI and
MDI. An SDI application (Single Document Interface) is typically used when you
want to work with one data set at a time in a single window. A commonly known
SDI application is Notepad.
An MDI application (Multiple Document Interface) has a primary window (par-
ent) that contains a set of child windows within its client region. A child window
is constrained to the boundaries of the parent window, and typically shares the
menu bar, tool bar, and other common parts of the parent interface. MDI appli-
cations are commonly used in situations where the user wants to work on multi-
ple data sets at the same time.
Swap chains are applicable to either windowing mode, but are more commonly
used within MDI applications. An SDI application can use swap chains, but they
should only be used when rendering to multiple controls when the problem can-
not be solved with the use of viewports. Typically, the swap chains for an SDI
application are created after the form is first opened and a Direct3D device is
bound to it.
An MDI application has a few more issues to be taken into consideration when
using swap chains within the child windows. Swap chains are only valid while the
device is still active; the swap chains become invalid as soon as the device is lost or
disposed. The device should be bound to the parent window since child windows
cannot exist without it, and the swap chains should be created within each indi-
vidual child window.
Multiple child windows will result in a system that must keep track of the swap chains
at a much more intimate level and handle their creation, assignment, and release.
Before diving into the solution and implementation, it is important to discuss sev-
eral “gotchas” and limitations that must be considered.
Common Pitfalls
An MDI application typically supports the resizing of child windows, so it is
important to take this issue into consideration when using swap chains. Direct3D
has a built-in mechanism to handle child window resizing, but the results may not
be desirable. A stretch blit is used by default to present the frame buffer if the client
area dimensions are not the same size as the frame buffer of the swap chain. This
mechanism can lead to artifacts and aliasing unless the swap chain is re-created
and the render target size is recalculated.
Search Nedrilad ::

Custom Search