aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2014-12-28 16:09:28 +0100
committerPierre Krieger <pierre.krieger1708@gmail.com>2014-12-31 07:34:27 +0100
commitc956559a5158e1d92ccc5acd7c89b025c68de758 (patch)
tree83dfb936f2577b136536d713414a0fc6355c3442 /src
parente1b5d9c1039c6e5a2e977bf2d6c9c3806cde046a (diff)
downloadglutin-c956559a5158e1d92ccc5acd7c89b025c68de758.tar.gz
glutin-c956559a5158e1d92ccc5acd7c89b025c68de758.zip
Add missing `with_*` functions
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index b3dfdd8..6a1c23b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -110,6 +110,11 @@ struct BuilderAttribs<'a> {
vsync: bool,
visible: bool,
multisampling: Option<u16>,
+ depth_bits: Option<u8>,
+ stencil_bits: Option<u8>,
+ color_bits: Option<u8>,
+ alpha_bits: Option<u8>,
+ stereoscopy: bool,
}
impl BuilderAttribs<'static> {
@@ -126,6 +131,11 @@ impl BuilderAttribs<'static> {
vsync: false,
visible: true,
multisampling: None,
+ depth_bits: None,
+ stencil_bits: None,
+ color_bits: None,
+ alpha_bits: None,
+ stereoscopy: false,
}
}
}
@@ -212,6 +222,31 @@ impl<'a> WindowBuilder<'a> {
self
}
+ /// Sets the number of bits in the depth buffer.
+ pub fn with_depth_buffer(mut self, bits: u8) -> WindowBuilder<'a> {
+ self.attribs.depth_bits = Some(bits);
+ self
+ }
+
+ /// Sets the number of bits in the stencil buffer.
+ pub fn with_stencil_buffer(mut self, bits: u8) -> WindowBuilder<'a> {
+ self.attribs.stencil_bits = Some(bits);
+ self
+ }
+
+ /// Sets the number of bits in the color buffer.
+ pub fn with_pixel_format(mut self, color_bits: u8, alpha_bits: u8) -> WindowBuilder<'a> {
+ self.attribs.color_bits = Some(color_bits);
+ self.attribs.alpha_bits = Some(alpha_bits);
+ self
+ }
+
+ /// Request the backend to be stereoscopic.
+ pub fn with_stereoscopy(mut self) -> WindowBuilder<'a> {
+ self.attribs.stereoscopy = true;
+ self
+ }
+
/// Builds the window.
///
/// Error should be very rare and only occur in case of permission denied, incompatible system,