aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 3c8b939..d65b415 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -91,6 +91,7 @@ pub struct WindowBuilder {
title: String,
monitor: Option<winimpl::MonitorID>,
gl_version: Option<(uint, uint)>,
+ gl_debug: bool,
vsync: bool,
visible: bool,
}
@@ -104,6 +105,7 @@ impl WindowBuilder {
title: "glutin window".to_string(),
monitor: None,
gl_version: None,
+ gl_debug: cfg!(ndebug),
vsync: false,
visible: true,
}
@@ -141,6 +143,15 @@ impl WindowBuilder {
self
}
+ /// Sets the *debug* flag for the OpenGL context.
+ ///
+ /// The default value for this flag is `cfg!(ndebug)`, which means that it's enabled
+ /// when you run `cargo build` and disabled when you run `cargo build --release`.
+ pub fn with_gl_debug_flag(mut self, flag: bool) -> WindowBuilder {
+ self.gl_debug = flag;
+ self
+ }
+
/// Requests that the window has vsync enabled.
pub fn with_vsync(mut self) -> WindowBuilder {
self.vsync = true;
@@ -178,6 +189,7 @@ impl WindowBuilder {
pub struct HeadlessRendererBuilder {
dimensions: (uint, uint),
gl_version: Option<(uint, uint)>,
+ gl_debug: bool,
}
#[cfg(feature = "headless")]
@@ -187,6 +199,7 @@ impl HeadlessRendererBuilder {
HeadlessRendererBuilder {
dimensions: (width, height),
gl_version: None,
+ gl_debug: cfg!(ndebug),
}
}
@@ -199,6 +212,15 @@ impl HeadlessRendererBuilder {
self
}
+ /// Sets the *debug* flag for the OpenGL context.
+ ///
+ /// The default value for this flag is `cfg!(ndebug)`, which means that it's enabled
+ /// when you run `cargo build` and disabled when you run `cargo build --release`.
+ pub fn with_gl_debug_flag(mut self, flag: bool) -> HeadlessRendererBuilder {
+ self.gl_debug = flag;
+ self
+ }
+
/// Builds the headless context.
///
/// Error should be very rare and only occur in case of permission denied, incompatible system,