aboutsummaryrefslogtreecommitdiffstats
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-rw-r--r--src/api/cocoa/mod.rs9
-rw-r--r--src/api/glx/mod.rs16
-rw-r--r--src/api/win32/init.rs16
3 files changed, 23 insertions, 18 deletions
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs
index bbc110d..a58001d 100644
--- a/src/api/cocoa/mod.rs
+++ b/src/api/cocoa/mod.rs
@@ -11,6 +11,7 @@ use Api;
use BuilderAttribs;
use CreationError;
use GlContext;
+use GlProfile;
use GlRequest;
use PixelFormat;
use native_monitor::NativeMonitorId;
@@ -470,11 +471,11 @@ impl Window {
}
fn create_context(view: id, builder: &BuilderAttribs) -> Result<(Option<IdRef>, Option<PixelFormat>), CreationError> {
- let profile = match (builder.gl_version, builder.gl_version.to_gl_version(), builder.gl_core) {
- (GlRequest::Latest, _, Some(false)) => NSOpenGLProfileVersionLegacy as u32,
+ let profile = match (builder.gl_version, builder.gl_version.to_gl_version(), builder.gl_profile) {
+ (GlRequest::Latest, _, Some(GlProfile::Compatibility)) => NSOpenGLProfileVersionLegacy as u32,
(GlRequest::Latest, _, _) => NSOpenGLProfileVersion4_1Core as u32,
- (_, Some(1 ... 2, _), Some(true)) |
- (_, Some(3 ... 4, _), Some(false)) =>
+ (_, Some(1 ... 2, _), Some(GlProfile::Core)) |
+ (_, Some(3 ... 4, _), Some(GlProfile::Compatibility)) =>
return Err(CreationError::NotSupported),
(_, Some(1 ... 2, _), _) => NSOpenGLProfileVersionLegacy as u32,
(_, Some(3, 0 ... 2), _) => NSOpenGLProfileVersion3_2Core as u32,
diff --git a/src/api/glx/mod.rs b/src/api/glx/mod.rs
index b0efc37..cb61dfa 100644
--- a/src/api/glx/mod.rs
+++ b/src/api/glx/mod.rs
@@ -3,6 +3,7 @@
use BuilderAttribs;
use CreationError;
use GlContext;
+use GlProfile;
use GlRequest;
use Api;
use PixelFormat;
@@ -52,14 +53,15 @@ impl Context {
},
}
- if let Some(core) = builder.gl_core {
+ if let Some(profile) = builder.gl_profile {
+ let flag = match profile {
+ GlProfile::Compatibility =>
+ ffi::glx_extra::CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
+ GlProfile::Core =>
+ ffi::glx_extra::CONTEXT_CORE_PROFILE_BIT_ARB,
+ };
attributes.push(ffi::glx_extra::CONTEXT_PROFILE_MASK_ARB as libc::c_int);
- attributes.push(if core {
- ffi::glx_extra::CONTEXT_CORE_PROFILE_BIT_ARB
- } else {
- ffi::glx_extra::CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB
- } as libc::c_int
- );
+ attributes.push(flag as libc::c_int);
}
if builder.gl_debug {
diff --git a/src/api/win32/init.rs b/src/api/win32/init.rs
index 3837069..e5b0b3a 100644
--- a/src/api/win32/init.rs
+++ b/src/api/win32/init.rs
@@ -17,6 +17,7 @@ use BuilderAttribs;
use CreationError;
use CreationError::OsError;
use CursorState;
+use GlProfile;
use GlRequest;
use PixelFormat;
@@ -374,17 +375,18 @@ unsafe fn create_context(extra: Option<(&gl::wgl_extra::Wgl, &BuilderAttribs<'st
},
}
- if let Some(core) = builder.gl_core {
+ if let Some(profile) = builder.gl_profile {
if is_extension_supported(extra_functions, hdc,
"WGL_ARB_create_context_profile")
{
+ let flag = match profile {
+ GlProfile::Compatibility =>
+ gl::wgl_extra::CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
+ GlProfile::Core =>
+ gl::wgl_extra::CONTEXT_CORE_PROFILE_BIT_ARB,
+ };
attributes.push(gl::wgl_extra::CONTEXT_PROFILE_MASK_ARB as libc::c_int);
- attributes.push(if core {
- gl::wgl_extra::CONTEXT_CORE_PROFILE_BIT_ARB
- } else {
- gl::wgl_extra::CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB
- } as libc::c_int
- );
+ attributes.push(flag as libc::c_int);
} else {
return Err(CreationError::NotSupported);
}