aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/egl
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-04-30 13:23:37 +0200
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-04-30 16:57:07 +0200
commitaa58f4149a65783b07c0dc401b5854ed80c4915e (patch)
treedd5d06aa46a1e18f0b93c2960dacc2cea9c81982 /src/api/egl
parenta08388bca1ca275fd1455ceae26ab06c02c81111 (diff)
downloadglutin-aa58f4149a65783b07c0dc401b5854ed80c4915e.tar.gz
glutin-aa58f4149a65783b07c0dc401b5854ed80c4915e.zip
Add a GlContext trait
Diffstat (limited to 'src/api/egl')
-rw-r--r--src/api/egl/mod.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/api/egl/mod.rs b/src/api/egl/mod.rs
index 9c8db62..a6b6bcc 100644
--- a/src/api/egl/mod.rs
+++ b/src/api/egl/mod.rs
@@ -2,6 +2,7 @@
use BuilderAttribs;
use CreationError;
+use GlContext;
use GlRequest;
use PixelFormat;
use Api;
@@ -156,8 +157,10 @@ impl Context {
pixel_format: pixel_format,
})
}
+}
- pub fn make_current(&self) {
+impl GlContext for Context {
+ unsafe fn make_current(&self) {
let ret = unsafe {
self.egl.MakeCurrent(self.display, self.surface, self.surface, self.context)
};
@@ -167,23 +170,19 @@ impl Context {
}
}
- pub fn get_pixel_format(&self) -> &PixelFormat {
- &self.pixel_format
- }
-
- pub fn is_current(&self) -> bool {
+ fn is_current(&self) -> bool {
unsafe { self.egl.GetCurrentContext() == self.context }
}
- pub fn get_proc_address(&self, addr: &str) -> *const () {
+ fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
let addr = CString::new(addr.as_bytes()).unwrap();
let addr = addr.as_ptr();
unsafe {
- self.egl.GetProcAddress(addr) as *const ()
+ self.egl.GetProcAddress(addr) as *const _
}
}
- pub fn swap_buffers(&self) {
+ fn swap_buffers(&self) {
let ret = unsafe {
self.egl.SwapBuffers(self.display, self.surface)
};
@@ -193,9 +192,13 @@ impl Context {
}
}
- pub fn get_api(&self) -> Api {
+ fn get_api(&self) -> Api {
self.api
}
+
+ fn get_pixel_format(&self) -> PixelFormat {
+ self.pixel_format.clone()
+ }
}
unsafe impl Send for Context {}