aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/cocoa/headless.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/cocoa/headless.rs')
-rw-r--r--src/api/cocoa/headless.rs21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/api/cocoa/headless.rs b/src/api/cocoa/headless.rs
index 298027f..75cca8d 100644
--- a/src/api/cocoa/headless.rs
+++ b/src/api/cocoa/headless.rs
@@ -1,6 +1,7 @@
use CreationError;
use CreationError::OsError;
use BuilderAttribs;
+use GlContext;
use libc;
use std::ptr;
@@ -9,6 +10,7 @@ use core_foundation::string::CFString;
use core_foundation::bundle::{CFBundleGetBundleWithIdentifier, CFBundleGetFunctionPointerForName};
use cocoa::base::{id, nil};
use cocoa::appkit::*;
+use PixelFormat;
mod gl {
include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs"));
@@ -56,8 +58,10 @@ impl HeadlessContext {
Ok(headless)
}
+}
- pub unsafe fn make_current(&self) {
+impl GlContext for HeadlessContext {
+ unsafe fn make_current(&self) {
self.context.makeCurrentContext();
gl::GenFramebuffersEXT(1, &mut framebuffer);
@@ -76,11 +80,11 @@ impl HeadlessContext {
}
}
- pub fn is_current(&self) -> bool {
+ fn is_current(&self) -> bool {
unimplemented!()
}
- pub fn get_proc_address(&self, _addr: &str) -> *const () {
+ fn get_proc_address(&self, _addr: &str) -> *const libc::c_void {
let symbol_name: CFString = _addr.parse().unwrap();
let framework_name: CFString = "com.apple.opengl".parse().unwrap();
let framework = unsafe {
@@ -89,12 +93,19 @@ impl HeadlessContext {
let symbol = unsafe {
CFBundleGetFunctionPointerForName(framework, symbol_name.as_concrete_TypeRef())
};
- symbol as *const ()
+ symbol as *const libc::c_void
+ }
+
+ fn swap_buffers(&self) {
}
- pub fn get_api(&self) -> ::Api {
+ fn get_api(&self) -> ::Api {
::Api::OpenGl
}
+
+ fn get_pixel_format(&self) -> PixelFormat {
+ unimplemented!();
+ }
}
unsafe impl Send for HeadlessContext {}