Graphics Reference
In-Depth Information
class
UWBD3D
_
GraphicsSystem {
Source file.
uwbgl
_
D3DGraphicsSystem2
.h
file in the
D3D Files/
GraphicsSystem
subfolder of
the
UWBGL
_
D3D
_
Lib3
project.
.
bool
CreateGraphicsContext(HWND hMainWindow);
// similar to verion 1 from UWB
_
D3D
_
Lib1
.
Create an additional
Swap Chain
for the RC (m_pD3DDevice).
LPDIRECT3DSWAPCHAIN9 CreateSwapChain(HWND hWindow);
private
:
.
LPDIRECT3DDEVICE9
m
_
pD3DDevice;
};
Listing 5.20.
GraphicsSystem
class (Tutorial 5.4).
create multiple hardware drawing buffers in the GHC to be associated with the
rendering states of each RC. So far, our
GraphicsSystem
class creates only one
hardware drawing buffer during the creation of GHC/RC in
CreateGraphics
Context()
. We need to extend the
GraphicsSystem
class to support the creation
of multiple hardware drawing buffers.
OpenGL.
OpenGL dictates that each RC must be associated with one unique
hardware drawing buffer. In this case, a new RC (
HGLRC
) must be created for
each GUI drawing area. The data type representing OpenGL rendering contexts
is
HGLRC
. To support multiple GUI drawing areas, we create a new
HGLRC
for each
GUI drawing area by calling the
wglCreateContext()
function.
D3D.
D3D supports the creation of
swap chains
to associate multiple drawing
buffers with each RC. For D3D release 9, the data type representing a swap chain
is
DIRECT3DSWAPCHAIN9
, and the data type representing the RC is
Direct3D
Device9
. To support multiple GUI drawing areas, we create one RC (
DIRECT3D
Device9
), and then for each GUI drawing area, we create a new
DIRECT3DSWAP
CHAIN9
object based on the same RC. Listing 5.20 shows that version 2 of the
UWBD3D
_
GraphicsSystem
class supports the creation of additional swap chains
for each RC. The detailed procedure of creating the swap chain is D3D-specific
and is not shown here.
Interface to GUI: The
WindowHandler
Class
In Figure 5.4, we saw that the
WindowHandler
class is designed to bridge the
graphics API and GUI API to implement the view/controller functionality.
Search WWH ::
Custom Search