#opengl #wrapper #gl-rs #enums #thin

rusty_gl

使用 gl-rs crate 的 OpenGL 安全轻量级包装器

8 个版本

使用旧的 Rust 2015

0.1.7 2018 年 8 月 18 日
0.1.6 2018 年 8 月 18 日

#69 in #thin

24 每月下载量

MIT/Apache

20KB
493

CRATE 已迁移至

https://crates.io/crates/rgl


lib.rs:

Rusty GL

rusty_gl 是 OpenGL C 绑定的 Rust 包装器,gl-rs 该 crate 的目标是:1. 使 Rust 中的 OpenGL 更易于使用

     This has been done by hiding weird (and unsafe!) casts from Rust code to the
     C interface, as well as using rust types over std::os::raw and std::ffi types. For example,
     some functions take in &str rather than std::ffi::CString.
 
2. Make OpenGL in Rust safer to use
     
     One way I have done this is by enforcing correct enum types when passing to functions.
     The C-Interface allowed for any GLenum to pass into a function where it was needed, but
     it is very easy to pass the wrong one, causing `GL_INVALID_ENUM` errors.
     Instead, I have made specific enum types, and then enforce those types when calling rusty-gl
     functions
     
3. Make OpenGL in Rust fit along nicely with other Rust code

     The C interface had camelCase interface, as well as requiring `unsafe` blocks everywhere.
     Rusty GL functions use the more Rust accepted `snake_case` for functions and `PascalCase`
     for types. Also, none of the functions require `unsafe {}` blocks to be used.

依赖项

~135KB