aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2014-11-18 17:55:26 +0100
committerPierre Krieger <pierre.krieger1708@gmail.com>2014-12-07 13:52:08 +0100
commitc893e4faec212953174c12c68538d55929c90ad3 (patch)
treebb5ed569b0f5042c00e1c454452fdc9e108cd424 /src/lib.rs
parent2320c2bc974fcc655553e678c457230f3e97de68 (diff)
downloadglutin-c893e4faec212953174c12c68538d55929c90ad3.tar.gz
glutin-c893e4faec212953174c12c68538d55929c90ad3.zip
Add get_api() function
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index b27ef97..bcfb11a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -84,6 +84,14 @@ impl std::error::Error for CreationError {
}
}
+/// All APIs related to OpenGL that you can possibly get while using glutin.
+pub enum Api {
+ /// The classical OpenGL. Available on Windows, Linux, OS/X.
+ OpenGl,
+ /// OpenGL embedded system. Available on Linux, Android.
+ OpenGlEs,
+}
+
/// Object that allows you to build windows.
#[cfg(feature = "window")]
pub struct WindowBuilder<'a> {
@@ -457,6 +465,15 @@ impl Window {
pub unsafe fn platform_display(&self) -> *mut libc::c_void {
self.window.platform_display()
}
+
+ /// Returns the API that is currently provided by this window.
+ ///
+ /// - On Windows and OS/X, this always returns `OpenGl`.
+ /// - On Android, this always returns `OpenGlEs`.
+ /// - On Linux, it must be checked at runtime.
+ pub fn get_api(&self) -> Api {
+ self.window.get_api()
+ }
}
#[cfg(feature = "window")]
@@ -488,6 +505,13 @@ impl HeadlessContext {
pub fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
self.context.get_proc_address(addr) as *const libc::c_void
}
+
+ /// Returns the API that is currently provided by this window.
+ ///
+ /// See `Window::get_api` for more infos.
+ pub fn get_api(&self) -> Api {
+ self.context.get_api()
+ }
}
#[cfg(feature = "headless")]