aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml30
-rw-r--r--examples/cursor.rs4
-rw-r--r--examples/support/mod.rs2
-rw-r--r--src/api/android/mod.rs4
-rw-r--r--src/api/caca/mod.rs2
-rw-r--r--src/api/cocoa/headless.rs4
-rw-r--r--src/api/cocoa/mod.rs6
-rw-r--r--src/api/egl/mod.rs2
-rw-r--r--src/api/emscripten/mod.rs2
-rw-r--r--src/api/glx/mod.rs2
-rw-r--r--src/api/ios/mod.rs4
-rw-r--r--src/api/osmesa/mod.rs4
-rw-r--r--src/api/wayland/mod.rs2
-rw-r--r--src/api/wgl/mod.rs2
-rw-r--r--src/api/win32/mod.rs2
-rw-r--r--src/api/x11/window.rs8
-rw-r--r--src/headless.rs16
-rw-r--r--src/lib.rs3
-rw-r--r--src/platform/emscripten/mod.rs2
-rw-r--r--src/platform/ios/mod.rs3
-rw-r--r--src/platform/linux/api_dispatch.rs2
-rw-r--r--src/platform/linux/mod.rs3
-rw-r--r--src/platform/windows/mod.rs4
-rw-r--r--src/window.rs15
24 files changed, 52 insertions, 76 deletions
diff --git a/Cargo.toml b/Cargo.toml
index e0dcaf3..de9d2d0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "glutin"
-version = "0.4.0"
+version = "0.4.2"
authors = ["tomaka <pierre.krieger1708@gmail.com>"]
description = "Cross-plaform OpenGL context provider."
keywords = ["windowing", "opengl"]
@@ -13,37 +13,37 @@ build = "build.rs"
[dependencies]
gl_common = "0.1.0"
lazy_static = "0.1.10"
-libc = "0.1"
+libc = "0.2"
shared_library = "0.1.0"
[build-dependencies]
-gl_generator = "0.1.0"
+gl_generator = "0.2.0"
khronos_api = "0.0.8"
[dev-dependencies]
-clock_ticks = "0.0.5"
+clock_ticks = "0.1.0"
[target.arm-linux-androideabi.dependencies.android_glue]
version = "0.1"
[target.i386-apple-ios.dependencies]
-objc = "0.1"
+objc = "0.1.8"
[target.x86_64-apple-ios.dependencies]
-objc = "0.1"
+objc = "0.1.8"
[target.aarch64-apple-ios.dependencies]
-objc = "0.1"
+objc = "0.1.8"
[target.armv7s-apple-ios.dependencies]
-objc = "0.1"
+objc = "0.1.8"
[target.armv7-apple-ios.dependencies]
-objc = "0.1"
+objc = "0.1.8"
[target.x86_64-apple-darwin.dependencies]
-objc = "0.1"
-cgl = "0"
+objc = "0.1.8"
+cgl = "0.1"
cocoa = "0.1.4"
core-foundation = "0"
core-graphics = "0"
@@ -53,7 +53,7 @@ winapi = "0.2"
shell32-sys = "0.1"
gdi32-sys = "0.1"
user32-sys = "~0.1.2"
-kernel32-sys = "0.1"
+kernel32-sys = "0.2"
dwmapi-sys = "0.1"
[target.i686-pc-windows-msvc.dependencies]
@@ -61,7 +61,7 @@ winapi = "0.2"
shell32-sys = "0.1"
gdi32-sys = "0.1"
user32-sys = "~0.1.2"
-kernel32-sys = "0.1"
+kernel32-sys = "0.2"
dwmapi-sys = "0.1"
[target.x86_64-pc-windows-gnu.dependencies]
@@ -69,7 +69,7 @@ winapi = "0.2"
shell32-sys = "0.1"
gdi32-sys = "0.1"
user32-sys = "~0.1.2"
-kernel32-sys = "0.1"
+kernel32-sys = "0.2"
dwmapi-sys = "0.1"
[target.x86_64-pc-windows-msvc.dependencies]
@@ -77,7 +77,7 @@ winapi = "0.2"
shell32-sys = "0.1"
gdi32-sys = "0.1"
user32-sys = "~0.1.2"
-kernel32-sys = "0.1"
+kernel32-sys = "0.2"
dwmapi-sys = "0.1"
[target.i686-unknown-linux-gnu.dependencies]
diff --git a/examples/cursor.rs b/examples/cursor.rs
index cbe6978..167c5cb 100644
--- a/examples/cursor.rs
+++ b/examples/cursor.rs
@@ -14,7 +14,7 @@ android_start!(main);
fn main() {
let window = glutin::WindowBuilder::new().build().unwrap();
window.set_title("A fantastic window!");
- unsafe { window.make_current() };
+ unsafe { window.make_current().unwrap() };
let context = support::load(&window);
let cursors = [MouseCursor::Default, MouseCursor::Crosshair, MouseCursor::Hand, MouseCursor::Arrow, MouseCursor::Move, MouseCursor::Text, MouseCursor::Wait, MouseCursor::Help, MouseCursor::Progress, MouseCursor::NotAllowed, MouseCursor::ContextMenu, MouseCursor::NoneCursor, MouseCursor::Cell, MouseCursor::VerticalText, MouseCursor::Alias, MouseCursor::Copy, MouseCursor::NoDrop, MouseCursor::Grab, MouseCursor::Grabbing, MouseCursor::AllScroll, MouseCursor::ZoomIn, MouseCursor::ZoomOut, MouseCursor::EResize, MouseCursor::NResize, MouseCursor::NeResize, MouseCursor::NwResize, MouseCursor::SResize, MouseCursor::SeResize, MouseCursor::SwResize, MouseCursor::WResize, MouseCursor::EwResize, MouseCursor::NsResize, MouseCursor::NeswResize, MouseCursor::NwseResize, MouseCursor::ColResize, MouseCursor::RowResize];
@@ -36,6 +36,6 @@ fn main() {
}
context.draw_frame((0.0, 1.0, 0.0, 1.0));
- window.swap_buffers();
+ window.swap_buffers().unwrap();
}
}
diff --git a/examples/support/mod.rs b/examples/support/mod.rs
index 6d5a931..ebbe379 100644
--- a/examples/support/mod.rs
+++ b/examples/support/mod.rs
@@ -13,7 +13,7 @@ pub struct Context {
}
pub fn load(window: &glutin::Window) -> Context {
- let gl = gl::Gl::load(window);
+ let gl = gl::Gl::load_with(|ptr| window.get_proc_address(ptr) as *const _);
let version = unsafe {
let data = CStr::from_ptr(gl.GetString(gl::VERSION) as *const _).to_bytes().to_vec();
diff --git a/src/api/android/mod.rs b/src/api/android/mod.rs
index 23440d3..3dcea90 100644
--- a/src/api/android/mod.rs
+++ b/src/api/android/mod.rs
@@ -263,7 +263,7 @@ impl GlContext for Window {
}
#[inline]
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
self.context.get_proc_address(addr)
}
@@ -323,7 +323,7 @@ impl GlContext for HeadlessContext {
}
#[inline]
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
self.0.get_proc_address(addr)
}
diff --git a/src/api/caca/mod.rs b/src/api/caca/mod.rs
index 43742f3..687c66f 100644
--- a/src/api/caca/mod.rs
+++ b/src/api/caca/mod.rs
@@ -252,7 +252,7 @@ impl GlContext for Window {
}
#[inline]
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
self.opengl.get_proc_address(addr)
}
diff --git a/src/api/cocoa/headless.rs b/src/api/cocoa/headless.rs
index 49b8bc3..1318185 100644
--- a/src/api/cocoa/headless.rs
+++ b/src/api/cocoa/headless.rs
@@ -91,7 +91,7 @@ impl GlContext for HeadlessContext {
}
#[inline]
- fn get_proc_address(&self, _addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, _addr: &str) -> *const () {
let symbol_name: CFString = _addr.parse().unwrap();
let framework_name: CFString = "com.apple.opengl".parse().unwrap();
let framework = unsafe {
@@ -100,7 +100,7 @@ impl GlContext for HeadlessContext {
let symbol = unsafe {
CFBundleGetFunctionPointerForName(framework, symbol_name.as_concrete_TypeRef())
};
- symbol as *const libc::c_void
+ symbol as *const ()
}
#[inline]
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs
index 2b4b5e5..c1b22c9 100644
--- a/src/api/cocoa/mod.rs
+++ b/src/api/cocoa/mod.rs
@@ -310,7 +310,7 @@ impl Window {
let obj = context.CGLContextObj();
let mut opacity = 0;
- CGLSetParameter(obj, kCGLCPSurfaceOpacity, &mut opacity);
+ CGLSetParameter(obj as *mut _, kCGLCPSurfaceOpacity, &mut opacity);
}
app.activateIgnoringOtherApps_(YES);
@@ -558,7 +558,7 @@ impl Window {
let value = if opengl.vsync { 1 } else { 0 };
cxt.setValues_forParameter_(&value, NSOpenGLContextParameter::NSOpenGLCPSwapInterval);
- CGLEnable(cxt.CGLContextObj(), kCGLCECrashOnRemovedFunctions);
+ CGLEnable(cxt.CGLContextObj() as *mut _, kCGLCECrashOnRemovedFunctions);
Ok((cxt, pf))
} else {
@@ -777,7 +777,7 @@ impl GlContext for Window {
}
}
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
let symbol_name: CFString = FromStr::from_str(addr).unwrap();
let framework_name: CFString = FromStr::from_str("com.apple.opengl").unwrap();
let framework = unsafe {
diff --git a/src/api/egl/mod.rs b/src/api/egl/mod.rs
index 0c0ec1f..53f8fc9 100644
--- a/src/api/egl/mod.rs
+++ b/src/api/egl/mod.rs
@@ -284,7 +284,7 @@ impl GlContext for Context {
unsafe { self.egl.GetCurrentContext() == self.context }
}
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
let addr = CString::new(addr.as_bytes()).unwrap();
let addr = addr.as_ptr();
unsafe {
diff --git a/src/api/emscripten/mod.rs b/src/api/emscripten/mod.rs
index 91304f0..61d8c8c 100644
--- a/src/api/emscripten/mod.rs
+++ b/src/api/emscripten/mod.rs
@@ -221,7 +221,7 @@ impl GlContext for Window {
true // FIXME:
}
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
let addr = CString::new(addr.as_bytes()).unwrap();
let addr = addr.as_ptr();
diff --git a/src/api/glx/mod.rs b/src/api/glx/mod.rs
index a7f8662..61a7d2f 100644
--- a/src/api/glx/mod.rs
+++ b/src/api/glx/mod.rs
@@ -82,7 +82,7 @@ impl GlContext for Context {
unsafe { self.glx.GetCurrentContext() == self.context }
}
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
let addr = CString::new(addr.as_bytes()).unwrap();
let addr = addr.as_ptr();
unsafe {
diff --git a/src/api/ios/mod.rs b/src/api/ios/mod.rs
index 52eebbf..852d97c 100644
--- a/src/api/ios/mod.rs
+++ b/src/api/ios/mod.rs
@@ -384,12 +384,12 @@ impl GlContext for Window {
false
}
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
let addr_c = CString::new(addr).unwrap();
let path = CString::new("/System/Library/Frameworks/OpenGLES.framework/OpenGLES").unwrap();
unsafe {
let lib = dlopen(path.as_ptr(), RTLD_LAZY | RTLD_GLOBAL);
- dlsym(lib, addr_c.as_ptr())
+ dlsym(lib, addr_c.as_ptr()) as *const _
}
}
diff --git a/src/api/osmesa/mod.rs b/src/api/osmesa/mod.rs
index c41c997..02c43a1 100644
--- a/src/api/osmesa/mod.rs
+++ b/src/api/osmesa/mod.rs
@@ -89,7 +89,7 @@ impl GlContext for OsMesaContext {
#[inline]
unsafe fn make_current(&self) -> Result<(), ContextError> {
let ret = osmesa_sys::OSMesaMakeCurrent(self.context, self.buffer.as_ptr()
- as *mut libc::c_void, 0x1401, self.width
+ as *mut _, 0x1401, self.width
as libc::c_int, self.height as libc::c_int);
// an error can only happen in case of invalid parameter, which would indicate a bug
@@ -106,7 +106,7 @@ impl GlContext for OsMesaContext {
unsafe { osmesa_sys::OSMesaGetCurrentContext() == self.context }
}
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
unsafe {
let c_str = CString::new(addr.as_bytes().to_vec()).unwrap();
mem::transmute(osmesa_sys::OSMesaGetProcAddress(mem::transmute(c_str.as_ptr())))
diff --git a/src/api/wayland/mod.rs b/src/api/wayland/mod.rs
index 81acbf0..2877713 100644
--- a/src/api/wayland/mod.rs
+++ b/src/api/wayland/mod.rs
@@ -456,7 +456,7 @@ impl GlContext for Window {
}
#[inline]
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
self.context.get_proc_address(addr)
}
diff --git a/src/api/wgl/mod.rs b/src/api/wgl/mod.rs
index f064931..0f6a944 100644
--- a/src/api/wgl/mod.rs
+++ b/src/api/wgl/mod.rs
@@ -171,7 +171,7 @@ impl GlContext for Context {
unsafe { gl::wgl::GetCurrentContext() == self.context.0 as *const libc::c_void }
}
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
let addr = CString::new(addr.as_bytes()).unwrap();
let addr = addr.as_ptr();
diff --git a/src/api/win32/mod.rs b/src/api/win32/mod.rs
index 4fb3635..d85ef09 100644
--- a/src/api/win32/mod.rs
+++ b/src/api/win32/mod.rs
@@ -365,7 +365,7 @@ impl GlContext for Window {
}
#[inline]
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
match self.context {
Context::Wgl(ref c) => c.get_proc_address(addr),
Context::Egl(ref c) => c.get_proc_address(addr),
diff --git a/src/api/x11/window.rs b/src/api/x11/window.rs
index cfe38d1..d82c5dd 100644
--- a/src/api/x11/window.rs
+++ b/src/api/x11/window.rs
@@ -351,8 +351,8 @@ impl Window {
Glx(::api::glx::ContextPrototype<'a>),
Egl(::api::egl::ContextPrototype<'a>),
}
- let builder_clone_opengl_glx = opengl.clone().map_sharing(|_| unimplemented!()); // FIXME:
- let builder_clone_opengl_egl = opengl.clone().map_sharing(|_| unimplemented!()); // FIXME:
+ let builder_clone_opengl_glx = opengl.clone().map_sharing(|_| unimplemented!()); // FIXME:
+ let builder_clone_opengl_egl = opengl.clone().map_sharing(|_| unimplemented!()); // FIXME:
let context = match opengl.version {
GlRequest::Latest | GlRequest::Specific(Api::OpenGl, _) | GlRequest::GlThenGles { .. } => {
// GLX should be preferred over EGL, otherwise crashes may occur
@@ -508,7 +508,7 @@ impl Window {
(*hint).res_name = c_name as *mut libc::c_char;
(*hint).res_class = c_name as *mut libc::c_char;
(display.xlib.XSetClassHint)(display.display, window, hint);
- (display.xlib.XFree)(hint as *mut libc::c_void);
+ (display.xlib.XFree)(hint as *mut _);
});
}
@@ -862,7 +862,7 @@ impl GlContext for Window {
}
#[inline]
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
match self.x.context {
Context::Glx(ref ctxt) => ctxt.get_proc_address(addr),
Context::Egl(ref ctxt) => ctxt.get_proc_address(addr),
diff --git a/src/headless.rs b/src/headless.rs
index 2317794..67ea8da 100644
--- a/src/headless.rs
+++ b/src/headless.rs
@@ -8,9 +8,6 @@ use PixelFormat;
use PixelFormatRequirements;
use Robustness;
-use gl_common;
-use libc;
-
use platform;
/// Object that allows you to build headless contexts.
@@ -103,8 +100,8 @@ impl HeadlessContext {
///
/// Contrary to `wglGetProcAddress`, all available OpenGL functions return an address.
#[inline]
- pub fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
- self.context.get_proc_address(addr) as *const libc::c_void
+ pub fn get_proc_address(&self, addr: &str) -> *const () {
+ self.context.get_proc_address(addr)
}
/// Returns the API that is currently provided by this window.
@@ -120,13 +117,6 @@ impl HeadlessContext {
}
}
-impl gl_common::GlFunctionsSource for HeadlessContext {
- #[inline]
- fn get_proc_addr(&self, addr: &str) -> *const libc::c_void {
- self.get_proc_address(addr)
- }
-}
-
impl GlContext for HeadlessContext {
#[inline]
unsafe fn make_current(&self) -> Result<(), ContextError> {
@@ -139,7 +129,7 @@ impl GlContext for HeadlessContext {
}
#[inline]
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
self.context.get_proc_address(addr)
}
diff --git a/src/lib.rs b/src/lib.rs
index b62c4a0..0246d52 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -29,7 +29,6 @@ extern crate lazy_static;
#[macro_use]
extern crate shared_library;
-extern crate gl_common;
extern crate libc;
#[cfg(target_os = "windows")]
@@ -112,7 +111,7 @@ pub trait GlContext {
fn is_current(&self) -> bool;
/// Returns the address of an OpenGL function.
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void;
+ fn get_proc_address(&self, addr: &str) -> *const ();
/// Swaps the buffers in case of double or triple buffering.
///
diff --git a/src/platform/emscripten/mod.rs b/src/platform/emscripten/mod.rs
index 0d059d7..270cdaf 100644
--- a/src/platform/emscripten/mod.rs
+++ b/src/platform/emscripten/mod.rs
@@ -28,7 +28,7 @@ impl GlContext for HeadlessContext {
}
#[inline]
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
self.0.get_proc_address(addr)
}
diff --git a/src/platform/ios/mod.rs b/src/platform/ios/mod.rs
index 95fa7e1..aeaebc3 100644
--- a/src/platform/ios/mod.rs
+++ b/src/platform/ios/mod.rs
@@ -1,5 +1,4 @@
#![cfg(target_os = "ios")]
-use libc::c_void;
use GlAttributes;
use CreationError;
@@ -33,7 +32,7 @@ impl HeadlessContext {
}
/// See the docs in the crate root file.
- pub fn get_proc_address(&self, _addr: &str) -> *const c_void {
+ pub fn get_proc_address(&self, _addr: &str) -> *const () {
unimplemented!()
}
diff --git a/src/platform/linux/api_dispatch.rs b/src/platform/linux/api_dispatch.rs
index aa1ba58..a3c3bf9 100644
--- a/src/platform/linux/api_dispatch.rs
+++ b/src/platform/linux/api_dispatch.rs
@@ -359,7 +359,7 @@ impl GlContext for Window {
}
#[inline]
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
match self {
&Window::X(ref w) => w.get_proc_address(addr),
&Window::Wayland(ref w) => w.get_proc_address(addr)
diff --git a/src/platform/linux/mod.rs b/src/platform/linux/mod.rs
index c984926..d010a89 100644
--- a/src/platform/linux/mod.rs
+++ b/src/platform/linux/mod.rs
@@ -7,7 +7,6 @@ use GlAttributes;
use GlContext;
use PixelFormat;
use PixelFormatRequirements;
-use libc;
use api::osmesa::{self, OsMesaContext};
@@ -45,7 +44,7 @@ impl GlContext for HeadlessContext {
}
#[inline]
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
self.0.get_proc_address(addr)
}
diff --git a/src/platform/windows/mod.rs b/src/platform/windows/mod.rs
index a280316..246ca51 100644
--- a/src/platform/windows/mod.rs
+++ b/src/platform/windows/mod.rs
@@ -4,8 +4,6 @@ pub use api::win32;
pub use api::win32::{MonitorId, get_available_monitors, get_primary_monitor};
pub use api::win32::{WindowProxy, PollEventsIterator, WaitEventsIterator};
-use libc;
-
use Api;
use ContextError;
use CreationError;
@@ -134,7 +132,7 @@ impl GlContext for HeadlessContext {
}
#[inline]
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
match self {
&HeadlessContext::HiddenWindow(ref ctxt) => ctxt.get_proc_address(addr),
&HeadlessContext::EglPbuffer(ref ctxt) => ctxt.get_proc_address(addr),
diff --git a/src/window.rs b/src/window.rs
index 7a87806..86322bd 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -18,9 +18,7 @@ use Window;
use WindowAttributes;
use native_monitor::NativeMonitorId;
-use gl_common;
use libc;
-
use platform;
/// Object that allows you to build windows.
@@ -397,8 +395,8 @@ impl Window {
///
/// Contrary to `wglGetProcAddress`, all available OpenGL functions return an address.
#[inline]
- pub fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
- self.window.get_proc_address(addr) as *const libc::c_void
+ pub fn get_proc_address(&self, addr: &str) -> *const () {
+ self.window.get_proc_address(addr)
}
/// Swaps the buffers in case of double or triple buffering.
@@ -492,13 +490,6 @@ impl Window {
}
}
-impl gl_common::GlFunctionsSource for Window {
- #[inline]
- fn get_proc_addr(&self, addr: &str) -> *const libc::c_void {
- self.get_proc_address(addr)
- }
-}
-
impl GlContext for Window {
#[inline]
unsafe fn make_current(&self) -> Result<(), ContextError> {
@@ -511,7 +502,7 @@ impl GlContext for Window {
}
#[inline]
- fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
+ fn get_proc_address(&self, addr: &str) -> *const () {
self.get_proc_address(addr)
}