Graphics Reference
In-Depth Information
class UWBD3D _ WindowHandler : public UWBGFX _ WindowHandler {
Source file.
uwbgl _ D3DWindowHandler3
.h file in the D3D Files/
WindowHander subfolder
// ... similar to earlier verion from UWB _ D3D _ LIB2
.
// must create and initialize m _ pSwapChain
virtual bool InitializeHandler(HWND hAttachedWindow);
.
virtual void BeginDraw();
// must activate the proper swap chain
virtual void EndDrawAndShow();
// present the proper hardware drawing buffer
protected :
LPDIRECT3DDEVICE9 m _ pD3DDevice;
// This is the reference to the D3D RC Device
LPDIRECT3DSWAPCHAIN9 m _ pSwapChain;
// This is the reference to the swap chain.
of
UWBGL _ D3D _ Lib3 project.
.
};
Listing 5.21. UWBD3D _ WindowHandler class (Tutorial 5.4).
Figure 5.6 illustrates that to fulfill this bridging function, the UWBD3D _ WindowHand
ler keeps references to the UIWindow and to the RC ( DIRECT3DDEVICE9 ). Now,
to support drawing to multiple hardware buffers, the UWBD3D _ WindowHandler
must also keep a reference to the DIRECT3DSWAPCHAIN9 . Listing 5.21 shows
that the new WindowHandler class must invoke the GraphicsSystem to create a
new swap chain during InitializeHandler() . Notice that BeginDraw() and
EndDrawAndShow() must now coordinate and activate proper swap chains to di-
rect the rendering of the RC to the proper hardware drawing buffer.
Implementation
With the new GraphicsSystem and WindowHandler support in the D3D library,
the changes to our application code are actually relatively straightforward.
CDrawOnlyHandler and CDrawAndMouseHandler .
We want the small
Source file.
DrawAndMouseHandler.h
file in the WindowHandler
folder of the D3D _ TwoViews
project.
window to be a draw-only window. These two classes are identical to the
ones from Tutorial 5.1 and Tutorial 5.2. The CTutorialDlg class has one
instance of each type of the handlers.
Search WWH ::




Custom Search