extern crate libc;
#[macro_use]
extern crate bitflags;
pub mod egl;
pub mod ffi;
pub mod error;
mod display;
mod context;
mod window_surface;
mod config_filter;
mod frame_buffer_config;
mod version;
pub use display::{Display, ContextClientVersion};
pub use context::Context;
pub use window_surface::Surface;
pub use config_filter::ConfigFilterRef;
pub use frame_buffer_config::FrameBufferConfigRef;
pub use version::Version;
use std::mem;
#[cfg(feature = "egl_1_5")]
pub fn query_version() -> error::Result<&'static str> {
let cstr = try!(egl::query_string(egl::EGL_NO_DISPLAY, egl::EGL_VERSION));
Ok(try!(cstr.to_str()))
}
pub fn query_extensions() -> error::Result<&'static str> {
let cstr = try!(egl::query_string(egl::EGL_NO_DISPLAY, egl::EGL_EXTENSIONS));
Ok(try!(cstr.to_str()))
}
#[repr(i32)]
#[derive(Copy, Clone, Debug)]
pub enum ColorBufferType {
Rgb = 0x308E,
Luminance = 0x308F,
}
impl ColorBufferType {
pub unsafe fn from_raw(value: egl::EGLint) -> ColorBufferType {
mem::transmute(value as i32)
}
}
#[repr(i32)]
#[derive(Copy, Clone, Debug)]
pub enum ConfigCaveat {
None = 0x3038,
Slow = 0x3050,
NonConformant = 0x3051,
}
impl ConfigCaveat {
pub unsafe fn from_raw(value: egl::EGLint) -> ConfigCaveat {
mem::transmute(value as i32)
}
}
#[repr(i32)]
#[derive(Copy, Clone, Debug)]
pub enum TransparentType {
None = 0x3038,
TransparentRgb = 0x3052,
}
impl TransparentType {
pub unsafe fn from_raw(value: egl::EGLint) -> TransparentType {
mem::transmute(value as i32)
}
}
pub mod renderable {
bitflags! {
pub flags Type: i32 {
const OPENGL = 0x0008,
const OPENGL_ES = 0x0001,
const OPENGL_ES2 = 0x0004,
const OPENGL_ES3 = 0x00000040,
const OPENVG = 0x0002,
}
}
}
pub mod surface {
bitflags! {
pub flags Type: i32 {
const PBUFFER = 0x0001,
const PIXMAP = 0x0002,
const WINDOW = 0x0004,
const VG_COLORSPACE_LINEAR = 0x0020,
const VG_ALPHA_FORMAT_PRE = 0x0040,
const MULTISAMPLE_RESOLVE_BOX = 0x0200,
const SWAP_BEHAVIOR_PRESERVED = 0x0400,
}
}
}