aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2015-01-21 10:58:08 -0500
committerJosh Matthews <josh@joshmatthews.net>2015-01-21 10:58:08 -0500
commite12e4bf38f30c74df35ca416ee2b7abbdb803526 (patch)
tree05475932fb76615939f81a3224fb939095a9f2b9 /src
parent862baf82204c373d17e2878871826a457529a03f (diff)
downloadglutin-e12e4bf38f30c74df35ca416ee2b7abbdb803526.tar.gz
glutin-e12e4bf38f30c74df35ca416ee2b7abbdb803526.zip
Fix OS X build.
Diffstat (limited to 'src')
-rw-r--r--src/osx/headless.rs32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/osx/headless.rs b/src/osx/headless.rs
index 3981058..cc19457 100644
--- a/src/osx/headless.rs
+++ b/src/osx/headless.rs
@@ -11,36 +11,30 @@ use cocoa::base::{id, nil};
use cocoa::appkit::*;
mod gl {
- generate_gl_bindings! {
- api: "gl",
- profile: "core",
- version: "3.2",
- generator: "global",
- extensions: ["GL_EXT_framebuffer_object"],
- }
+ include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs"));
}
static mut framebuffer: u32 = 0;
static mut texture: u32 = 0;
pub struct HeadlessContext {
- width: usize,
- height: usize,
+ width: u32,
+ height: u32,
context: id,
}
impl HeadlessContext {
pub fn new(builder: BuilderAttribs) -> Result<HeadlessContext, CreationError> {
- let (width, height) = builder.dimensions;
+ let (width, height) = builder.dimensions.unwrap_or((1024, 768));
let context = unsafe {
let attributes = [
- NSOpenGLPFADoubleBuffer as usize,
- NSOpenGLPFAClosestPolicy as usize,
- NSOpenGLPFAColorSize as usize, 24,
- NSOpenGLPFAAlphaSize as usize, 8,
- NSOpenGLPFADepthSize as usize, 24,
- NSOpenGLPFAStencilSize as usize, 8,
- NSOpenGLPFAOffScreen as usize,
+ NSOpenGLPFADoubleBuffer as u32,
+ NSOpenGLPFAClosestPolicy as u32,
+ NSOpenGLPFAColorSize as u32, 24,
+ NSOpenGLPFAAlphaSize as u32, 8,
+ NSOpenGLPFADepthSize as u32, 24,
+ NSOpenGLPFAStencilSize as u32, 8,
+ NSOpenGLPFAOffScreen as u32,
0
];
@@ -87,8 +81,8 @@ impl HeadlessContext {
}
pub fn get_proc_address(&self, _addr: &str) -> *const () {
- let symbol_name: CFString = from_str(_addr).unwrap();
- let framework_name: CFString = from_str("com.apple.opengl").unwrap();
+ let symbol_name: CFString = _addr.parse().unwrap();
+ let framework_name: CFString = "com.apple.opengl".parse().unwrap();
let framework = unsafe {
CFBundleGetBundleWithIdentifier(framework_name.as_concrete_TypeRef())
};