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
use crate::gl_context::{GLContextDispatcher, GLVersion};
use sparkle::gl;
pub trait NativeGLContextMethods: Sized {
type Handle;
fn get_proc_address(proc: &str) -> *const ();
fn current() -> Option<Self>;
fn current_handle() -> Option<Self::Handle>;
fn create_shared(with: Option<&Self::Handle>,
api_type: &gl::GlType,
api_version: GLVersion) -> Result<Self, &'static str>;
fn create_shared_with_dispatcher(with: Option<&Self::Handle>,
api_type: &gl::GlType,
api_version: GLVersion,
_dispatcher: Option<Box<dyn GLContextDispatcher>>)
-> Result<Self, &'static str> {
Self::create_shared(with, api_type, api_version)
}
fn create_headless(api_type: &gl::GlType, api_version: GLVersion) -> Result<Self, &'static str> {
Self::create_shared(None, api_type, api_version)
}
fn handle(&self) -> Self::Handle;
fn is_current(&self) -> bool;
fn make_current(&self) -> Result<(), &'static str>;
fn unbind(&self) -> Result<(), &'static str>;
fn is_osmesa(&self) -> bool { false }
}
#[cfg(all(unix, not(any(target_os = "macos", target_os = "android", target_os = "ios")), feature="x11"))]
pub mod with_glx;
#[cfg(all(unix, not(any(target_os = "macos", target_os = "android", target_os = "ios")), feature="x11"))]
pub use self::with_glx::{NativeGLContext, NativeGLContextHandle};
#[cfg(feature="osmesa")]
pub mod with_osmesa;
#[cfg(feature="osmesa")]
pub use self::with_osmesa::{OSMesaContext, OSMesaContextHandle};
#[cfg(all(unix, not(any(target_os = "macos", target_os = "android")), not(feature="x11")))]
pub use self::with_osmesa::{OSMesaContext as NativeGLContext, OSMesaContextHandle as NativeGLContextHandle};
#[cfg(any(
target_os="android",
all(target_os="windows", feature="no_wgl"),
all(target_os="linux", feature = "test_egl_in_linux"),
))]
pub mod with_egl;
#[cfg(any(target_os="android", all(target_os="windows", feature="no_wgl")))]
pub use self::with_egl::{NativeGLContext, NativeGLContextHandle};
#[cfg(target_os="macos")]
pub mod with_cgl;
#[cfg(target_os="macos")]
pub use self::with_cgl::{NativeGLContext, NativeGLContextHandle};
#[cfg(all(target_os="windows", not(feature="no_wgl")))]
pub mod with_wgl;
#[cfg(all(target_os="windows", not(feature="no_wgl")))]
pub use self::with_wgl::{NativeGLContext, NativeGLContextHandle};
#[cfg(target_os="ios")]
pub mod with_eagl;
#[cfg(target_os="ios")]
pub use self::with_eagl::{NativeGLContext, NativeGLContextHandle};
#[cfg(not(any(unix, target_os="windows")))]
pub mod not_implemented;
#[cfg(not(any(unix, target_os="windows")))]
pub use self::not_implemented::{NativeGLContext, NativeGLContextHandle};