From 8c1b2dd63370fe102b2a447e7840fc038413b6cc Mon Sep 17 00:00:00 2001 From: Tomaka17 Date: Sun, 9 Nov 2014 16:07:58 +0100 Subject: Add support for the OpenGL debug flag --- src/win32/init.rs | 9 +++++++-- src/win32/mod.rs | 9 +++++---- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/win32') diff --git a/src/win32/init.rs b/src/win32/init.rs index 88ff069..90d6184 100644 --- a/src/win32/init.rs +++ b/src/win32/init.rs @@ -16,8 +16,8 @@ local_data_key!(WINDOW: (ffi::HWND, Sender)) pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: String, builder_monitor: Option, - builder_gl_version: Option<(uint, uint)>, builder_vsync: bool, - builder_hidden: bool) -> Result + builder_gl_version: Option<(uint, uint)>, builder_debug: bool, + builder_vsync: bool, builder_hidden: bool) -> Result { use std::mem; use std::os; @@ -298,6 +298,11 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin attributes.push(version.val1() as libc::c_int); } + if builder_debug { + attributes.push(ffi::wgl_extra::CONTEXT_FLAGS_ARB as libc::c_int); + attributes.push(ffi::wgl_extra::CONTEXT_DEBUG_BIT_ARB as libc::c_int); + } + attributes.push(0); let ctxt = unsafe { diff --git a/src/win32/mod.rs b/src/win32/mod.rs index 282b0bb..b282385 100644 --- a/src/win32/mod.rs +++ b/src/win32/mod.rs @@ -24,8 +24,8 @@ pub struct HeadlessContext(Window); impl HeadlessContext { /// See the docs in the crate root file. pub fn new(builder: HeadlessRendererBuilder) -> Result { - let HeadlessRendererBuilder { dimensions, gl_version } = builder; - init::new_window(Some(dimensions), "".to_string(), None, gl_version, false, true) + let HeadlessRendererBuilder { dimensions, gl_version, gl_debug } = builder; + init::new_window(Some(dimensions), "".to_string(), None, gl_version, gl_debug, false, true) .map(|w| HeadlessContext(w)) } @@ -68,8 +68,9 @@ pub struct Window { impl Window { /// See the docs in the crate root file. pub fn new(builder: WindowBuilder) -> Result { - let WindowBuilder { dimensions, title, monitor, gl_version, vsync, visible } = builder; - init::new_window(dimensions, title, monitor, gl_version, vsync, !visible) + let WindowBuilder { dimensions, title, monitor, gl_version, + gl_debug, vsync, visible } = builder; + init::new_window(dimensions, title, monitor, gl_version, gl_debug, vsync, !visible) } } -- cgit v1.2.3