aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-02-19 21:55:15 +0100
committertomaka <pierre.krieger1708@gmail.com>2015-02-19 21:55:15 +0100
commit8e1d0f7a976078ef7031ff84e077f00655d4e061 (patch)
treee03c5d40096b2545fe02fed2ec4668a3872cc3cd /src/lib.rs
parent95d70ce549f776794a89c6c83d1df707b914ab8f (diff)
parentf4f84c6566d99c297cddee3c712e94927f313204 (diff)
downloadglutin-8e1d0f7a976078ef7031ff84e077f00655d4e061.tar.gz
glutin-8e1d0f7a976078ef7031ff84e077f00655d4e061.zip
Merge pull request #282 from tomaka/gl-api
Improve the OpenGL context request system
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 1bd29bb..3798ffd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -114,6 +114,30 @@ pub enum Api {
WebGl,
}
+/// Describes the OpenGL API and version that are being requested when a context is created.
+#[derive(Debug, Copy, Clone)]
+pub enum GlRequest {
+ /// Request the latest version of the "best" API of this platform.
+ ///
+ /// On desktop, will try OpenGL.
+ Latest,
+
+ /// Request a specific version of a specific API.
+ ///
+ /// Example: `GlRequest::Specific(Api::OpenGl, (3, 3))`.
+ Specific(Api, (u8, u8)),
+
+ /// If OpenGL is available, create an OpenGL context with the specified `opengl_version`.
+ /// Else if OpenGL ES or WebGL is available, create a context with the
+ /// specified `opengles_version`.
+ GlThenGles {
+ /// The version to use for OpenGL.
+ opengl_version: (u8, u8),
+ /// The version to use for OpenGL ES.
+ opengles_version: (u8, u8),
+ },
+}
+
#[derive(Debug, Copy)]
pub enum MouseCursor {
/// The platform-dependent default cursor.
@@ -194,7 +218,7 @@ struct BuilderAttribs<'a> {
dimensions: Option<(u32, u32)>,
title: String,
monitor: Option<winimpl::MonitorID>,
- gl_version: Option<(u32, u32)>,
+ gl_version: GlRequest,
gl_debug: bool,
vsync: bool,
visible: bool,
@@ -215,7 +239,7 @@ impl BuilderAttribs<'static> {
dimensions: None,
title: "glutin window".to_string(),
monitor: None,
- gl_version: None,
+ gl_version: GlRequest::Latest,
gl_debug: cfg!(ndebug),
vsync: false,
visible: true,