aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2014-11-09 17:03:10 +0100
committertomaka <pierre.krieger1708@gmail.com>2014-11-09 17:03:10 +0100
commit7d00bedbdbe832b081f675f41304411cfb04935e (patch)
treec3bf069645933f06c5942d258bb4c3f54f75b58d /src/lib.rs
parent9ee0875d4e6cdd7d8e66afc9d39efe99197a2b54 (diff)
parent8c1b2dd63370fe102b2a447e7840fc038413b6cc (diff)
downloadglutin-7d00bedbdbe832b081f675f41304411cfb04935e.tar.gz
glutin-7d00bedbdbe832b081f675f41304411cfb04935e.zip
Merge pull request #104 from tomaka/debug-flag
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,