objc2_open_gl/
lib.rs

1//! # Bindings to the `OpenGL` framework
2//!
3//! Note that this crate intentionally leaves out the cross-platform parts of
4//! the OpenGL API. See crates like `gl` or `gl_generator` for that instead.
5//!
6//! See [the OpenGL programming guide][opengl-docs] and [the general docs on
7//! framework crates][framework-crates] for more information.
8//!
9//! [opengl-docs]: https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_intro/opengl_intro.html
10//! [framework-crates]: https://docs.rs/objc2/latest/objc2/topics/about_generated/index.html
11#![no_std]
12#![cfg_attr(feature = "unstable-darwin-objc", feature(darwin_objc))]
13#![cfg_attr(docsrs, feature(doc_cfg))]
14// Update in Cargo.toml as well.
15#![doc(html_root_url = "https://docs.rs/objc2-opengl/0.3.2")]
16#![deprecated = "The OpenGL API is deprecated by Apple"]
17
18#[cfg(feature = "alloc")]
19extern crate alloc;
20
21#[cfg(feature = "std")]
22extern crate std;
23
24mod generated;
25#[allow(unused_imports, unreachable_pub)]
26pub use self::generated::*;
27
28// OpenGL/gltypes.h
29#[allow(unused)]
30pub(crate) type GLbitfield = u32;
31#[allow(unused)]
32pub(crate) type GLenum = u32;
33#[allow(unused)]
34pub(crate) type GLint = i32;
35#[allow(unused)]
36pub(crate) type GLsizei = i32;
37#[allow(unused)]
38pub(crate) type GLuint = u32;
39
40// OpenGL/CGLContext.h
41#[allow(unused)]
42mod context {
43    use core::cell::UnsafeCell;
44    use core::marker::{PhantomData, PhantomPinned};
45    use objc2::encode::{Encoding, RefEncode};
46
47    #[repr(C)]
48    #[derive(Debug)]
49    #[allow(missing_copy_implementations)]
50    #[allow(unreachable_pub)]
51    pub struct _CGLContextObject {
52        inner: [u8; 0],
53        _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
54    }
55
56    unsafe impl RefEncode for _CGLContextObject {
57        const ENCODING_REF: Encoding =
58            Encoding::Pointer(&Encoding::Struct("_CGLContextObject", &[]));
59    }
60}
61
62#[allow(unused)]
63pub(crate) use self::context::_CGLContextObject;