Game Development Reference
In-Depth Information
PFD.nSize = sizeof( PIXELFORMATDESCRIPTOR );
PFD.nVersion = 1;
PFD.dwFlags = PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
PFD.iPixelType = PFD_TYPE_RGBA;
PFD.cColorBits = static_cast<BYTE>(BitsPerPixel & 0xFF);
PFD.cDepthBits = static_cast<BYTE>(ZBufferBits & 0xFF);
PFD.cStencilBits = static_cast<BYTE>(StencilBits & 0xFF);
PFD.iLayerType = PFD_MAIN_PLANE;
GLint PixelFormat = 0;
4.
Tr y to use the extension if the valid pointer is available:
if ( LGL3->wglChoosePixelFormatARB )
{
const int Attribs[] =
{
WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
WGL_DOUBLE_BUFFER_ARB , GL_TRUE,
WGL_PIXEL_TYPE_ARB , WGL_TYPE_RGBA_ARB,
WGL_COLOR_BITS_ARB , BitsPerPixel,
WGL_DEPTH_BITS_ARB , ZBufferBits,
WGL_STENCIL_BITS_ARB , StencilBits,
WGL_SAMPLE_BUFFERS_ARB, GL_TRUE,
WGL_SAMPLES_ARB , Multisample,
0 // zero marks the end of values
};
GLuint Count = 0;
LGL3->wglChoosePixelFormatARB( DeviceContext,
Attribs, NULL, 1, &PixelFormat, &Count );
if ( !PixelFormat )
{
PixelFormat = ::ChoosePixelFormat(
DeviceContext, &PFD );
}
return ::SetPixelFormat( DeviceContext,
PixelFormat, NULL );
}
 
Search WWH ::




Custom Search