Win32: Fix multisample pixel formats

This commit is contained in:
Elias Naur 2005-01-31 22:33:27 +00:00
parent 9ecd426e31
commit 074175fa89
1 changed files with 12 additions and 10 deletions

View File

@ -707,37 +707,39 @@ static bool createARBContextAndPixelFormat(JNIEnv *env, HDC hdc, jobject pixel_f
// Some crazy strangeness here so we can use ARB_pixel_format to specify the number // Some crazy strangeness here so we can use ARB_pixel_format to specify the number
// of multisamples we want. If the extension is present we'll delete the existing // of multisamples we want. If the extension is present we'll delete the existing
// rendering context and start over, using the ARB extension instead to pick the context. // rendering context and start over, using the ARB extension instead to pick the context.
if ( !extgl_Extensions.WGL_ARB_pixel_format ) if (!extgl_Extensions.WGL_ARB_pixel_format)
return false; return false;
pixel_format_index = findPixelFormatARB(env, hdc, pixel_format, NULL, true, true, true, true); pixel_format_index = findPixelFormatARB(env, hdc, pixel_format, NULL, true, true, true, true);
if ( pixel_format_index == -1 ) { if (pixel_format_index == -1) {
pixel_format_index = findPixelFormatARB(env, hdc, pixel_format, NULL, true, true, false, true); pixel_format_index = findPixelFormatARB(env, hdc, pixel_format, NULL, true, true, false, true);
if ( pixel_format_index == -1 ) if ( pixel_format_index == -1)
return false; return false;
} }
arb_hwnd = createWindow(0, 0, 1, 1, false, false); arb_hwnd = createWindow(0, 0, 1, 1, false, false);
if ( arb_hwnd == NULL ) if (arb_hwnd == NULL)
return false; return false;
arb_hdc = GetDC(arb_hwnd); arb_hdc = GetDC(arb_hwnd);
if ( !applyPixelFormat(arb_hdc, pixel_format_index) ) { if (!applyPixelFormat(arb_hdc, pixel_format_index)) {
closeWindow(&arb_hwnd, &arb_hdc); closeWindow(&arb_hwnd, &arb_hdc);
return false; return false;
} }
arb_context = wglCreateContext(arb_hdc); arb_context = wglCreateContext(arb_hdc);
closeWindow(&arb_hwnd, &arb_hdc); if (arb_context == NULL) {
if ( arb_context == NULL ) closeWindow(&arb_hwnd, &arb_hdc);
return false; return false;
}
if ( !wglMakeCurrent(arb_hdc, arb_context) ) { if (!wglMakeCurrent(arb_hdc, arb_context)) {
wglDeleteContext(arb_context); wglDeleteContext(arb_context);
closeWindow(&arb_hwnd, &arb_hdc);
return false; return false;
} }
extgl_InitWGL(env); extgl_InitWGL(env);
wglMakeCurrent(NULL, NULL);
closeWindow(&arb_hwnd, &arb_hdc);
*pixel_format_index_return = pixel_format_index; *pixel_format_index_return = pixel_format_index;
*context_return = arb_context; *context_return = arb_context;