diff options
author | Pierre Krieger <pierre.krieger1708@gmail.com> | 2015-12-19 13:56:25 +0100 |
---|---|---|
committer | Pierre Krieger <pierre.krieger1708@gmail.com> | 2015-12-19 13:56:25 +0100 |
commit | a428e0608fa4104a5c79208f94f6f5bc6ce04b9d (patch) | |
tree | e60622f30c5be3fb36004ac2e1cfe53e9919e98c /src | |
parent | 6b3a3a45770b870c241c1244863c4a0b5cd791d2 (diff) | |
download | glutin-a428e0608fa4104a5c79208f94f6f5bc6ce04b9d.tar.gz glutin-a428e0608fa4104a5c79208f94f6f5bc6ce04b9d.zip |
Update cocoa implementation with changes to pf_reqs
Diffstat (limited to 'src')
-rw-r--r-- | src/api/cocoa/mod.rs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs index b7e0239..2ae2c23 100644 --- a/src/api/cocoa/mod.rs +++ b/src/api/cocoa/mod.rs @@ -13,6 +13,7 @@ use GlProfile; use GlRequest; use PixelFormat; use PixelFormatRequirements; +use ReleaseBehavior; use Robustness; use WindowAttributes; use native_monitor::NativeMonitorId; @@ -493,6 +494,8 @@ impl Window { let alpha_depth = pf_reqs.alpha_bits.unwrap_or(8); let color_depth = pf_reqs.color_bits.unwrap_or(24) + alpha_depth; + // TODO: handle hardware_accelerated parameter of pf_reqs + let mut attributes = vec![ NSOpenGLPFADoubleBuffer as u32, NSOpenGLPFAClosestPolicy as u32, @@ -503,10 +506,19 @@ impl Window { NSOpenGLPFAOpenGLProfile as u32, profile, ]; - // A color depth higher than 64 implies we're using either 16-bit - // floats or 32-bit floats and OS X requires a flag to be set - // accordingly. - if color_depth >= 64 { + if reqs.release_behavior != ReleaseBehavior::Flush { + return Err(CreationError::NoAvailablePixelFormat); + } + + if reqs.stereoscopy { + unimplemented!(); // TODO: + } + + if reqs.double_buffer == Some(false) { + unimplemented!(); // TODO: + } + + if pf_reqs.float_color_buffer { attributes.push(NSOpenGLPFAColorFloat as u32); } |