mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-31 05:40:04 -04:00
Implement multisampling for x11
This commit is contained in:
14
src/lib.rs
14
src/lib.rs
@@ -94,6 +94,7 @@ pub struct WindowBuilder<'a> {
|
||||
gl_debug: bool,
|
||||
vsync: bool,
|
||||
visible: bool,
|
||||
multisampling: Option<u16>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "window")]
|
||||
@@ -109,6 +110,7 @@ impl<'a> WindowBuilder<'a> {
|
||||
gl_debug: cfg!(ndebug),
|
||||
vsync: false,
|
||||
visible: true,
|
||||
multisampling: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,6 +175,18 @@ impl<'a> WindowBuilder<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the multisampling level to request.
|
||||
///
|
||||
/// # Panic
|
||||
///
|
||||
/// Will panic if `samples` is not a power of two.
|
||||
pub fn with_multisampling(mut self, samples: u16) -> WindowBuilder<'a> {
|
||||
use std::num::UnsignedInt;
|
||||
assert!(samples.is_power_of_two());
|
||||
self.multisampling = Some(samples);
|
||||
self
|
||||
}
|
||||
|
||||
/// Builds the window.
|
||||
///
|
||||
/// Error should be very rare and only occur in case of permission denied, incompatible system,
|
||||
|
||||
Reference in New Issue
Block a user