Game Development Reference
In-Depth Information
We must now add two member variables to the Dialog class for our
application CWGLExampleDlg:
HDC m_hDC;
HGLRC m_hRC.
If you have done much Windows programming then you will realize
that m_hDC is a handle to a device context. These are used extensively
in Windows programming to shield the programmer from the actual
hardware on which their software runs. m_hRC, however, may well be
new to you. This is a special rendering context used by OpenGL to
allow a single thread to use the OpenGL engine for several different
views. In this simple example we only have one view that contains an
OpenGL display; consequently, we have a single rendering context
which we store in the member variable, m_hRC. Before we can create
a rendering context we need to tinker with the way that our main device
context deals with pixels. For this there is a structure called a
PIXELFORMATDESCRIPTOR and that is exactly what it does, it
describes the pixel format. The full declaration of a PIXELFORMAT-
DESCRIPTOR is given below.
typedef struct tagPIXELFORMATDESCRIPTOR { // pfd
WORD nSize;
WORD nVersion;
DWORD dwFlags;
BYTE
iPixelType;
BYTE
cColorBits;
BYTE
cRedBits;
BYTE
cRedShift;
BYTE
cGreenBits;
BYTE
cGreenShift;
BYTE
cBlueBits;
BYTE
cBlueShift;
BYTE
cAlphaBits;
BYTE
cAlphaShift;
BYTE
cAccumBits;
BYTE
cAccumRedBits;
BYTE
cAccumGreenBits;
BYTE
cAccumBlueBits;
BYTE
cAccumAlphaBits;
BYTE
cDepthBits;
Search Nedrilad ::




Custom Search