diff options
author | tomaka <pierre.krieger1708@gmail.com> | 2015-09-21 14:15:41 +0200 |
---|---|---|
committer | tomaka <pierre.krieger1708@gmail.com> | 2015-09-21 14:15:41 +0200 |
commit | 6787f1d43493f0f8c2310ac3c3d5cb409d13ec40 (patch) | |
tree | 03056bc49bd5ec0da9e155176a74c2d23a8fc603 /src/platform/linux/mod.rs | |
parent | f51ace4c7885fa25c146c24181c4d87f5632de3e (diff) | |
parent | 62bafe2130db5aaf32bd46091581086ae435e4cf (diff) | |
download | glutin-6787f1d43493f0f8c2310ac3c3d5cb409d13ec40.tar.gz glutin-6787f1d43493f0f8c2310ac3c3d5cb409d13ec40.zip |
Merge pull request #603 from tomaka/gl-attribs
Separate the builder attributes into multiple substates
Diffstat (limited to 'src/platform/linux/mod.rs')
-rw-r--r-- | src/platform/linux/mod.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/platform/linux/mod.rs b/src/platform/linux/mod.rs index 3525ce5..f5d663b 100644 --- a/src/platform/linux/mod.rs +++ b/src/platform/linux/mod.rs @@ -1,11 +1,12 @@ #![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd"))] use Api; -use BuilderAttribs; use ContextError; use CreationError; +use GlAttributes; use GlContext; use PixelFormat; +use PixelFormatRequirements; use libc; use api::osmesa::{self, OsMesaContext}; @@ -25,8 +26,12 @@ pub type MonitorID = (); // TODO: hack to make things work pub struct HeadlessContext(OsMesaContext); impl HeadlessContext { - pub fn new(builder: BuilderAttribs) -> Result<HeadlessContext, CreationError> { - match OsMesaContext::new(builder) { + pub fn new(dimensions: (u32, u32), pf_reqs: &PixelFormatRequirements, + opengl: &GlAttributes<&HeadlessContext>) -> Result<HeadlessContext, CreationError> + { + let opengl = opengl.clone().map_sharing(|c| &c.0); + + match OsMesaContext::new(dimensions, pf_reqs, &opengl) { Ok(c) => return Ok(HeadlessContext(c)), Err(osmesa::OsMesaCreationError::NotSupported) => (), Err(osmesa::OsMesaCreationError::CreationError(e)) => return Err(e), |