diff options
Diffstat (limited to 'src/window.rs')
-rw-r--r-- | src/window.rs | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/window.rs b/src/window.rs index 0dd9905..c21b82d 100644 --- a/src/window.rs +++ b/src/window.rs @@ -6,6 +6,8 @@ use BuilderAttribs; use CreationError; use CursorState; use Event; +use GlContext; +use GlProfile; use GlRequest; use MouseCursor; use PixelFormat; @@ -66,6 +68,12 @@ impl<'a> WindowBuilder<'a> { self } + /// Sets the desired OpenGL context profile. + pub fn with_gl_profile(mut self, profile: GlProfile) -> WindowBuilder<'a> { + self.attribs.gl_profile = Some(profile); + self + } + /// Sets the *debug* flag for the OpenGL context. /// /// The default value for this flag is `cfg!(debug_assertions)`, which means that it's enabled @@ -428,6 +436,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 +471,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. |