aboutsummaryrefslogtreecommitdiffstats
path: root/src/x11/window
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2014-11-24 19:35:31 +0100
committerPierre Krieger <pierre.krieger1708@gmail.com>2014-11-27 15:26:42 +0100
commit729551f82859673fcf9b4b26dbb145184a2a7ca7 (patch)
tree6e556313801c3d959ae3d05455deadd66797dcd0 /src/x11/window
parent596132dc9300f43385e5bb8c3f24df49cfe8529d (diff)
downloadglutin-729551f82859673fcf9b4b26dbb145184a2a7ca7.tar.gz
glutin-729551f82859673fcf9b4b26dbb145184a2a7ca7.zip
Implement multisampling for x11
Diffstat (limited to 'src/x11/window')
-rw-r--r--src/x11/window/mod.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs
index 8662fdc..72c7133 100644
--- a/src/x11/window/mod.rs
+++ b/src/x11/window/mod.rs
@@ -58,7 +58,7 @@ impl Window {
// getting the FBConfig
let fb_config = unsafe {
- const VISUAL_ATTRIBUTES: [libc::c_int, ..23] = [
+ let mut visual_attributes = vec![
ffi::GLX_X_RENDERABLE, 1,
ffi::GLX_DRAWABLE_TYPE, ffi::GLX_WINDOW_BIT,
ffi::GLX_RENDER_TYPE, ffi::GLX_RGBA_BIT,
@@ -73,10 +73,17 @@ impl Window {
0
];
+ if let Some(val) = builder.multisampling {
+ visual_attributes.push(ffi::glx::SAMPLE_BUFFERS as libc::c_int);
+ visual_attributes.push(1);
+ visual_attributes.push(ffi::glx::SAMPLES as libc::c_int);
+ visual_attributes.push(val as libc::c_int);
+ }
+
let mut num_fb: libc::c_int = mem::uninitialized();
let fb = ffi::glx::ChooseFBConfig(display, ffi::XDefaultScreen(display),
- VISUAL_ATTRIBUTES.as_ptr(), &mut num_fb);
+ visual_attributes.as_ptr(), &mut num_fb);
if fb.is_null() {
return Err(OsError(format!("glx::ChooseFBConfig failed")));
}