1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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,
}
}
}