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
//! # siftgl
//!
//! A memory-safe, ergonomic, **zero-dependency**, security-hardened OpenGL 3.3–4.6 Core
//! frontend for Rust.
//!
//! `siftgl` brings the safety and ergonomics philosophy of `siftx12` and `siftvulkan` to OpenGL:
//!
//! - **Zero Third-Party Dependencies:** Directly loads `opengl32.dll` (Windows), `libGL.so.1`
//! (Linux), or `OpenGL.framework` (macOS) using native OS dynamic linking, or binds to any
//! windowing library via [`GlContext::from_loader`]. Includes built-in headless WGL Core Profile
//! context creation (`GlContext::new_offscreen`) on Windows.
//! - **Compile-Time Thread Affinity:** [`GlContext`] and all OpenGL resources are `!Send + !Sync`,
//! preventing cross-thread OpenGL context misuse at compile time.
//! - **FFI Encapsulation & Explicit Safety Invariants:** Every `unsafe` FFI call is encapsulated
//! behind validated Rust types with explicit `// SAFETY:` comments and
//! `#![forbid(unsafe_op_in_unsafe_fn)]`.
//! - **Zero Panicking Unwraps:** All fallible operations return [`Result<T>`] (`GlError`),
//! with clippy denies on `unwrap_used`, `expect_used`, `panic`, `todo`, and `unimplemented`.
//! - **RAII Resource Lifecycle & Teardown Ordering:** Every GPU object ([`Buffer`], [`Shader`],
//! [`Program`], [`VertexArray`], [`Texture`], [`Sampler`], [`Framebuffer`], [`Renderbuffer`],
//! [`SyncFence`], [`Query`], [`DebugGuard`]) is deterministically destroyed on `Drop`, keeping
//! the dispatch table and native context alive until the last object drops.
//! - **Security & Bounds Hardening:** Checked integer arithmetic on all byte ranges, pixel buffer
//! length validation on texture uploads and `read_pixels`, double-map prevention on [`Buffer`],
//! WGL sentinel pointer filtering (`0`/`1`/`2`/`3`/`-1`), interior-NUL string rejection, and
//! panic-safe `catch_unwind` C FFI trampolines for `KHR_debug` callbacks.
//!
//! ## Quick Start
//!
//! ```no_run
//! use siftgl::{Buffer, BufferDesc, ContextDesc, GlContext};
//!
//! fn main() -> siftgl::Result<()> {
//! #[cfg(windows)]
//! {
//! let gl = GlContext::new_offscreen(&ContextDesc::default())?;
//! let vbo = Buffer::new(&gl, &BufferDesc::vertex(256))?;
//! vbo.write_bytes(0, b"hello opengl!")?;
//! gl.check_error()?;
//! }
//! Ok(())
//! }
//! ```
pub
// Core re-exports
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;