diff options
author | Dzmitry Malyshau <kvarkus@gmail.com> | 2015-04-29 23:05:47 -0400 |
---|---|---|
committer | Dzmitry Malyshau <kvarkus@gmail.com> | 2015-04-30 22:50:15 -0400 |
commit | a42f1f58333a9899d36e18e641f3f52517dd58b1 (patch) | |
tree | 8e11e18d3bb3fc4f5a3a5a65eb7c895d515c105c /src/lib.rs | |
parent | c1ca5d1d87166daa20d4ae2a9a0a7c8d4ba2ba63 (diff) | |
download | glutin-a42f1f58333a9899d36e18e641f3f52517dd58b1.tar.gz glutin-a42f1f58333a9899d36e18e641f3f52517dd58b1.zip |
Implemented gl_core flag
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -161,6 +161,22 @@ pub enum GlRequest { }, } +impl GlRequest { + /// Extract the desktop GL version, if any. + pub fn to_gl_version(&self) -> Option<(u8, u8)> { + match self { + &GlRequest::Specific(Api::OpenGl, version) => Some(version), + &GlRequest::GlThenGles { opengl_version: version, .. } => Some(version), + _ => None, + } + } +} + +/// The minimum core profile GL context. Useful for getting the minimum +/// required GL version while still running on OSX, which often forbids +/// the compatibility profile features. +pub static GL_CORE: GlRequest = GlRequest::Specific(Api::OpenGl, (3, 2)); + #[derive(Debug, Copy, Clone)] pub enum MouseCursor { /// The platform-dependent default cursor. @@ -261,6 +277,7 @@ pub struct BuilderAttribs<'a> { title: String, monitor: Option<platform::MonitorID>, gl_version: GlRequest, + gl_core: Option<bool>, gl_debug: bool, vsync: bool, visible: bool, @@ -283,6 +300,7 @@ impl BuilderAttribs<'static> { title: "glutin window".to_string(), monitor: None, gl_version: GlRequest::Latest, + gl_core: None, gl_debug: cfg!(debug_assertions), vsync: false, visible: true, @@ -309,6 +327,7 @@ impl<'a> BuilderAttribs<'a> { title: self.title, monitor: self.monitor, gl_version: self.gl_version, + gl_core: self.gl_core, gl_debug: self.gl_debug, vsync: self.vsync, visible: self.visible, |