1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| // pBuffer attributes
int pf_attr[] =
{
WGL_PBUFFER_LARGEST_ARB, 1, // Get the largest available pBuffer (size will be limited if ressources
0 // are insufficient but will never exeed the specified width & height)
};
wglGetPixelFormatAttribivEXT( WGL_MAX_PBUFFER_WIDTH_ARB );
m_hpBuffer = wglCreatePbufferARB(m_oldhDC, pixelFormat, m_width, m_height, pf_attr);
// Retrieve pBuffer dimensions, in case they differ from the requested ones
int pWidth, pHeight;
wglQueryPbufferARB(m_hpBuffer, WGL_PBUFFER_WIDTH_ARB, &pWidth);
wglQueryPbufferARB(m_hpBuffer, WGL_PBUFFER_HEIGHT_ARB, &pHeight);
// Quit if the pBuffer creation failed
if(!m_hpBuffer)
{
MessageBox(NULL, _T("Could not create the p-buffer"), _T("ERROR"), MB_OK | MB_ICONEXCLAMATION);
return FALSE;
}
// Copy the new size if necessary)
if((m_width != pWidth) || (m_height != pHeight))
{
m_width = pWidth;
m_height = pHeight;
MessageBox(NULL, _T("p-buffer size-limited due to insufficient hardware ressources. Consider upgrading your graphic chipset"), _T("ERROR"), MB_OK | MB_ICONEXCLAMATION);
} |
Partager