Prefer GLX over EGL

fixes #314 for me.

I've "tested" change by running examples (which prior to change simply
crashed), but since I did not run those examples successfuly ever before,
I don't know whether they worked as intended.
This commit is contained in:
Zetok Zalbavar 2015-08-14 14:56:17 +01:00
parent 5c60456e16
commit 6c73209746
No known key found for this signature in database
GPG key ID: C953D3880212068A

View file

@ -351,10 +351,12 @@ impl Window {
let builder_clone = builder.clone();
let context = match builder.gl_version {
GlRequest::Latest | GlRequest::Specific(Api::OpenGl, _) | GlRequest::GlThenGles { .. } => {
if let Some(ref egl) = display.egl {
Prototype::Egl(try!(EglContext::new(egl.clone(), &builder_clone, egl::NativeDisplay::X11(Some(display.display as *const _)))))
} else if let Some(ref glx) = display.glx {
// GLX should be preferred over EGL, otherwise crashes may occur
// on X11 issue #314
if let Some(ref glx) = display.glx {
Prototype::Glx(try!(GlxContext::new(glx.clone(), &display.xlib, &builder_clone, display.display)))
} else if let Some(ref egl) = display.egl {
Prototype::Egl(try!(EglContext::new(egl.clone(), &builder_clone, egl::NativeDisplay::X11(Some(display.display as *const _)))))
} else {
return Err(CreationError::NotSupported);
}