aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorTomaka17 <pierre.krieger1708@gmail.com>2014-11-09 16:07:58 +0100
committerTomaka17 <pierre.krieger1708@gmail.com>2014-11-09 16:44:53 +0100
commit8c1b2dd63370fe102b2a447e7840fc038413b6cc (patch)
treec3bf069645933f06c5942d258bb4c3f54f75b58d /src/lib.rs
parent9ee0875d4e6cdd7d8e66afc9d39efe99197a2b54 (diff)
downloadglutin-8c1b2dd63370fe102b2a447e7840fc038413b6cc.tar.gz
glutin-8c1b2dd63370fe102b2a447e7840fc038413b6cc.zip
Add support for the OpenGL debug flag
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,