Merge pull request #59 from tomaka/update

Update for rustc and gl-rs
This commit is contained in:
tomaka 2014-10-22 11:28:10 +02:00
commit 2a29e4d743
8 changed files with 63 additions and 17 deletions

View file

@ -7,13 +7,23 @@ use glutin;
#[cfg(not(target_os = "android"))] #[cfg(not(target_os = "android"))]
mod gl { mod gl {
generate_gl_bindings!("gl", "core", "1.1", "struct") generate_gl_bindings! {
api: "gl",
profile: "core",
version: "1.1",
generator: "struct"
}
} }
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
mod gl { mod gl {
pub use self::Gles1 as Gl; pub use self::Gles1 as Gl;
generate_gl_bindings!("gles1", "core", "1.1", "struct") generate_gl_bindings! {
api: "gles1",
profile: "core",
version: "1.1",
generator: "struct"
}
} }
pub struct Context { pub struct Context {

View file

@ -17,7 +17,12 @@ pub mod egl {
pub type NativePixmapType = super::EGLNativePixmapType; pub type NativePixmapType = super::EGLNativePixmapType;
pub type NativeWindowType = super::EGLNativeWindowType; pub type NativeWindowType = super::EGLNativeWindowType;
generate_gl_bindings!("egl", "core", "1.5", "static") generate_gl_bindings! {
api: "egl",
profile: "core",
version: "1.5",
generator: "static"
}
} }
pub type khronos_utime_nanoseconds_t = khronos_uint64_t; pub type khronos_utime_nanoseconds_t = khronos_uint64_t;

View file

@ -7,12 +7,25 @@ use libc;
/// WGL bindings /// WGL bindings
pub mod wgl { pub mod wgl {
generate_gl_bindings!("wgl", "core", "1.0", "static") generate_gl_bindings! {
api: "wgl",
profile: "core",
version: "1.0",
generator: "static"
}
} }
/// Functions that are not necessarly always available /// Functions that are not necessarly always available
pub mod wgl_extra { pub mod wgl_extra {
generate_gl_bindings!("wgl", "core", "1.0", "struct", [ "WGL_ARB_create_context" ]) generate_gl_bindings! {
api: "wgl",
profile: "core",
version: "1.0",
generator: "struct",
extensions: [
"WGL_ARB_create_context"
]
}
} }
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx // http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx

View file

@ -2,7 +2,7 @@ extern crate native;
use self::native::NativeTaskBuilder; use self::native::NativeTaskBuilder;
use std::task::TaskBuilder; use std::task::TaskBuilder;
use std::sync::atomics::AtomicBool; use std::sync::atomic::AtomicBool;
use std::ptr; use std::ptr;
use super::{event, ffi}; use super::{event, ffi};
use super::Window; use super::Window;

View file

@ -1,4 +1,4 @@
use std::sync::atomics::AtomicBool; use std::sync::atomic::AtomicBool;
use std::ptr; use std::ptr;
use Event; use Event;
@ -75,7 +75,7 @@ impl Window {
impl Window { impl Window {
/// See the docs in the crate root file. /// See the docs in the crate root file.
pub fn is_closed(&self) -> bool { pub fn is_closed(&self) -> bool {
use std::sync::atomics::Relaxed; use std::sync::atomic::Relaxed;
self.is_closed.load(Relaxed) self.is_closed.load(Relaxed)
} }
@ -170,7 +170,7 @@ impl Window {
// if one of the received events is `Closed`, setting `is_closed` to true // if one of the received events is `Closed`, setting `is_closed` to true
if events.iter().find(|e| match e { &&::Closed => true, _ => false }).is_some() { if events.iter().find(|e| match e { &&::Closed => true, _ => false }).is_some() {
use std::sync::atomics::Relaxed; use std::sync::atomic::Relaxed;
self.is_closed.store(true, Relaxed); self.is_closed.store(true, Relaxed);
} }
@ -185,7 +185,7 @@ impl Window {
// if the received event is `Closed`, setting `is_closed` to true // if the received event is `Closed`, setting `is_closed` to true
match ev { match ev {
::Closed => { ::Closed => {
use std::sync::atomics::Relaxed; use std::sync::atomic::Relaxed;
self.is_closed.store(true, Relaxed); self.is_closed.store(true, Relaxed);
}, },
_ => () _ => ()
@ -198,7 +198,7 @@ impl Window {
}, },
Err(_) => { Err(_) => {
use std::sync::atomics::Relaxed; use std::sync::atomic::Relaxed;
self.is_closed.store(true, Relaxed); self.is_closed.store(true, Relaxed);
vec![] vec![]
} }

View file

@ -8,12 +8,25 @@ use libc;
/// GLX bindings /// GLX bindings
pub mod glx { pub mod glx {
generate_gl_bindings!("glx", "core", "1.4", "static") generate_gl_bindings! {
api: "glx",
profile: "core",
version: "1.4",
generator: "static"
}
} }
/// Functions that are not necessarly always available /// Functions that are not necessarly always available
pub mod glx_extra { pub mod glx_extra {
generate_gl_bindings!("glx", "core", "1.4", "struct", [ "GLX_ARB_create_context" ]) generate_gl_bindings! {
api: "glx",
profile: "core",
version: "1.4",
generator: "struct",
extensions: [
"GLX_ARB_create_context"
]
}
} }
pub type Atom = libc::c_ulong; pub type Atom = libc::c_ulong;

View file

@ -1,7 +1,7 @@
use {Event, WindowBuilder}; use {Event, WindowBuilder};
use libc; use libc;
use std::{mem, ptr}; use std::{mem, ptr};
use std::sync::atomics::AtomicBool; use std::sync::atomic::AtomicBool;
use super::ffi; use super::ffi;
pub use self::monitor::{MonitorID, get_available_monitors, get_primary_monitor}; pub use self::monitor::{MonitorID, get_available_monitors, get_primary_monitor};
@ -260,7 +260,7 @@ impl Window {
} }
pub fn is_closed(&self) -> bool { pub fn is_closed(&self) -> bool {
use std::sync::atomics::Relaxed; use std::sync::atomic::Relaxed;
self.is_closed.load(Relaxed) self.is_closed.load(Relaxed)
} }
@ -340,7 +340,7 @@ impl Window {
ffi::ClientMessage => { ffi::ClientMessage => {
use Closed; use Closed;
use std::sync::atomics::Relaxed; use std::sync::atomic::Relaxed;
let client_msg: &ffi::XClientMessageEvent = unsafe { mem::transmute(&xev) }; let client_msg: &ffi::XClientMessageEvent = unsafe { mem::transmute(&xev) };

View file

@ -7,7 +7,12 @@ extern crate glutin;
extern crate libc; extern crate libc;
mod gl { mod gl {
generate_gl_bindings!("gl", "core", "1.1", "struct") generate_gl_bindings! {
api: "gl",
profile: "core",
version: "1.1",
generator: "struct"
}
} }
#[cfg(feature = "headless")] #[cfg(feature = "headless")]