Fixed wglChoosePixelFormatARB crashing when not supported

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1304 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2009-12-04 06:35:03 +00:00
parent f3f630142a
commit 053042bf5a

View File

@ -514,7 +514,8 @@ void WindowImplWin32::CreateContext(const VideoMode& Mode, WindowSettings& Param
{ {
// Get the wglChoosePixelFormatARB function (it is an extension) // Get the wglChoosePixelFormatARB function (it is an extension)
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = reinterpret_cast<PFNWGLCHOOSEPIXELFORMATARBPROC>(wglGetProcAddress("wglChoosePixelFormatARB")); PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = reinterpret_cast<PFNWGLCHOOSEPIXELFORMATARBPROC>(wglGetProcAddress("wglChoosePixelFormatARB"));
if (wglChoosePixelFormatARB)
{
// Define the basic attributes we want for our window // Define the basic attributes we want for our window
int IntAttributes[] = int IntAttributes[] =
{ {
@ -577,6 +578,13 @@ void WindowImplWin32::CreateContext(const VideoMode& Mode, WindowSettings& Param
} }
} }
} }
else
{
// wglChoosePixelFormatARB not supported ; disabling antialiasing
std::cerr << "Antialiasing is not supported ; it will be disabled" << std::endl;
Params.AntialiasingLevel = 0;
}
}
// Find a pixel format with no antialiasing, if not needed or not supported // Find a pixel format with no antialiasing, if not needed or not supported
if (BestFormat == 0) if (BestFormat == 0)