Update for changes in gl-rs

This commit is contained in:
Tomaka17 2014-11-05 15:22:21 +01:00
parent 2e44edea60
commit 7ce851dad9
4 changed files with 59 additions and 37 deletions

View file

@ -31,6 +31,8 @@
#[phase(plugin)] extern crate compile_msg;
#[phase(plugin)] extern crate gl_generator;
extern crate gl_common;
extern crate libc;
#[cfg(target_os = "macos")]
@ -397,6 +399,13 @@ impl Window {
}
}
#[cfg(feature = "window")]
impl gl_common::GlFunctionsSource for Window {
fn get_proc_addr(&self, addr: &str) -> *const libc::c_void {
self.get_proc_address(addr)
}
}
/// Represents a headless OpenGL context.
#[cfg(feature = "headless")]
pub struct HeadlessContext {
@ -421,6 +430,13 @@ impl HeadlessContext {
}
}
#[cfg(feature = "headless")]
impl gl_common::GlFunctionsSource for HeadlessContext {
fn get_proc_addr(&self, addr: &str) -> *const libc::c_void {
self.get_proc_address(addr)
}
}
/// An iterator for the `poll_events` function.
// Implementation note: we retreive the list once, then serve each element by one by one.
// This may change in the future.

View file

@ -350,7 +350,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
if builder_vsync {
if extra_functions.SwapIntervalEXT.is_loaded() {
unsafe { ffi::wgl::MakeCurrent(hdc, context) };
if extra_functions.SwapIntervalEXT(1) == 0 {
if unsafe { extra_functions.SwapIntervalEXT(1) } == 0 {
tx.send(Err(format!("wglSwapIntervalEXT failed")));
unsafe { ffi::wgl::DeleteContext(context); }
unsafe { ffi::DestroyWindow(real_window); }