diff options
author | tomaka <pierre.krieger1708@gmail.com> | 2015-04-30 17:32:53 +0200 |
---|---|---|
committer | tomaka <pierre.krieger1708@gmail.com> | 2015-04-30 17:32:53 +0200 |
commit | d3fbbfb7a777f8f7b6a39b66dd982cbc8cb802ba (patch) | |
tree | dd5d06aa46a1e18f0b93c2960dacc2cea9c81982 /src/window.rs | |
parent | a08388bca1ca275fd1455ceae26ab06c02c81111 (diff) | |
parent | aa58f4149a65783b07c0dc401b5854ed80c4915e (diff) | |
download | glutin-d3fbbfb7a777f8f7b6a39b66dd982cbc8cb802ba.tar.gz glutin-d3fbbfb7a777f8f7b6a39b66dd982cbc8cb802ba.zip |
Merge pull request #412 from tomaka/glcontext-trait
Add a GlContext trait
Diffstat (limited to 'src/window.rs')
-rw-r--r-- | src/window.rs | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/window.rs b/src/window.rs index 0dd9905..7508f32 100644 --- a/src/window.rs +++ b/src/window.rs @@ -6,6 +6,7 @@ use BuilderAttribs; use CreationError; use CursorState; use Event; +use GlContext; use GlRequest; use MouseCursor; use PixelFormat; @@ -428,6 +429,32 @@ impl gl_common::GlFunctionsSource for Window { } } +impl GlContext for Window { + unsafe fn make_current(&self) { + self.make_current() + } + + fn is_current(&self) -> bool { + self.is_current() + } + + fn get_proc_address(&self, addr: &str) -> *const libc::c_void { + self.get_proc_address(addr) + } + + fn swap_buffers(&self) { + self.swap_buffers() + } + + fn get_api(&self) -> Api { + self.get_api() + } + + fn get_pixel_format(&self) -> PixelFormat { + self.get_pixel_format() + } +} + /// Represents a thread safe subset of operations that can be called /// on a window. This structure can be safely cloned and sent between /// threads. @@ -437,7 +464,6 @@ pub struct WindowProxy { } impl WindowProxy { - /// Triggers a blocked event loop to wake up. This is /// typically called when another thread wants to wake /// up the blocked rendering thread to cause a refresh. |