Add support for the OpenGL debug flag
This commit is contained in:
parent
9ee0875d4e
commit
8c1b2dd633
4 changed files with 39 additions and 6 deletions
22
src/lib.rs
22
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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue