Add a fallback on win32 if enumerate_arb_pixel_formats returns vec![]

This commit is contained in:
Pierre Krieger 2015-04-29 14:17:51 +02:00
parent c752142e04
commit 9ed1a0ec19

View file

@ -205,7 +205,12 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>,
// calling SetPixelFormat // calling SetPixelFormat
let pixel_format = { let pixel_format = {
let formats = if extra_functions.GetPixelFormatAttribivARB.is_loaded() { let formats = if extra_functions.GetPixelFormatAttribivARB.is_loaded() {
enumerate_arb_pixel_formats(&extra_functions, &real_window) let f = enumerate_arb_pixel_formats(&extra_functions, &real_window);
if f.is_empty() {
enumerate_native_pixel_formats(&real_window)
} else {
f
}
} else { } else {
enumerate_native_pixel_formats(&real_window) enumerate_native_pixel_formats(&real_window)
}; };