Starting Game Programming-Part5
hi gamers,
Continuing where we left...
4)Painting and drawing is still handles by WM_PAINT
Case WM_PAINT:
{
//opengl command for drawing
RenderScene();
ValidateRect(hWnd , NULL);
}
break;
In order for OpenGL to draw in a window, the window must be created with the
WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles set
5) Pixel Format sets a device context opengl properties such as color depth
and whether the window is double bufefred.You must set the pixel format for a
device context before it can be used to create a rendering context. Here are the
two functions you will need to use:
int ChoosePixelFormat(HDC hDC , PIXELFORMATDESCRIPTOR *ppfd)
BOOL SetPixelFormat(HDC hDC ,int iPixelFormat ,iXELFORMATDESCRIPTOR *ppfd)
setting of pixel format is 3 step process
a) First fill out the PIXELFORMATDESCRIPTOR structure
b)then pass this structure to ChooosePixelFormat function it returns a integer
index to available pixel fromat for specified device context.
c)this index is passed to SetPixelFormat function.
Continuing where we left...
4)Painting and drawing is still handles by WM_PAINT
Case WM_PAINT:
{
//opengl command for drawing
RenderScene();
ValidateRect(hWnd , NULL);
}
break;
In order for OpenGL to draw in a window, the window must be created with the
WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles set
5) Pixel Format sets a device context opengl properties such as color depth
and whether the window is double bufefred.You must set the pixel format for a
device context before it can be used to create a rendering context. Here are the
two functions you will need to use:
int ChoosePixelFormat(HDC hDC , PIXELFORMATDESCRIPTOR *ppfd)
BOOL SetPixelFormat(HDC hDC ,int iPixelFormat ,iXELFORMATDESCRIPTOR *ppfd)
setting of pixel format is 3 step process
a) First fill out the PIXELFORMATDESCRIPTOR structure
b)then pass this structure to ChooosePixelFormat function it returns a integer
index to available pixel fromat for specified device context.
c)this index is passed to SetPixelFormat function.