aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-01-18 09:09:50 +0100
committertomaka <pierre.krieger1708@gmail.com>2015-01-18 09:09:50 +0100
commit00460364cabc33435a9fd46af74739edbee6f482 (patch)
tree37e284b24edb389de13ad3d4657e93f3915fb9ab
parent495f6f886d1b2a1d1a253d6b4ae7b1df060ed700 (diff)
parent75c14c52138173b6fe8f69c284c935a0d90dde6d (diff)
downloadglutin-00460364cabc33435a9fd46af74739edbee6f482.tar.gz
glutin-00460364cabc33435a9fd46af74739edbee6f482.zip
Merge pull request #208 from kazimuth/osxcontext
Fix #177 merge conflicts
-rw-r--r--src/osx/mod.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/osx/mod.rs b/src/osx/mod.rs
index 59d979a..86a891c 100644
--- a/src/osx/mod.rs
+++ b/src/osx/mod.rs
@@ -71,7 +71,7 @@ impl Window {
unimplemented!()
}
- Window::new_impl(builder.dimensions, builder.title.as_slice(), builder.monitor, builder.vsync, builder.visible)
+ Window::new_impl(builder.dimensions, builder.title.as_slice(), builder.monitor, builder.vsync, builder.visible, builder.gl_version)
}
}
@@ -138,7 +138,7 @@ extern fn window_did_resize(this: id, _: id) -> id {
impl Window {
fn new_impl(dimensions: Option<(u32, u32)>, title: &str, monitor: Option<MonitorID>,
- vsync: bool, visible: bool) -> Result<Window, CreationError> {
+ vsync: bool, visible: bool, gl_version: Option<(u32, u32)>) -> Result<Window, CreationError> {
let app = match Window::create_app() {
Some(app) => app,
None => { return Err(OsError(format!("Couldn't create NSApplication"))); },
@@ -152,7 +152,7 @@ impl Window {
None => { return Err(OsError(format!("Couldn't create NSView"))); },
};
- let context = match Window::create_context(view, vsync) {
+ let context = match Window::create_context(view, vsync, gl_version) {
Some(context) => context,
None => { return Err(OsError(format!("Couldn't create OpenGL context"))); },
};
@@ -268,7 +268,12 @@ impl Window {
}
}
- fn create_context(view: id, vsync: bool) -> Option<id> {
+ fn create_context(view: id, vsync: bool, gl_version: Option<(u32, u32)>) -> Option<id> {
+ let profile = match gl_version {
+ None | Some((0...2, _)) | Some((3, 0)) => NSOpenGLProfileVersionLegacy as u32,
+ Some((3, 1...2)) => NSOpenGLProfileVersion3_2Core as u32,
+ Some((_, _)) => NSOpenGLProfileVersion4_1Core as u32,
+ };
unsafe {
let attributes = [
NSOpenGLPFADoubleBuffer as u32,
@@ -277,6 +282,7 @@ impl Window {
NSOpenGLPFAAlphaSize as u32, 8,
NSOpenGLPFADepthSize as u32, 24,
NSOpenGLPFAStencilSize as u32, 8,
+ NSOpenGLPFAOpenGLProfile as u32, profile,
0
];