Crates.io | glrs |
lib.rs | glrs |
version | 0.1.0 |
source | src |
created_at | 2024-01-15 00:31:15.170424 |
updated_at | 2024-01-15 00:31:15.170424 |
description | Macros for padding-equivalent importing of OpenGL constructs |
homepage | |
repository | https://github.com/HoloTheDrunk/glrs |
max_upload_size | |
id | 1099844 |
size | 28,249 |
Passing data between Rust and OpenGL is error-prone and mistakes can be hard to debug.
This crate provides compile-time conversion of GLSL constructs to Rust based on the glam crate.
[dependencies]
glrs = "0.1"
Only tested on rustc 1.75.
shaders/utils.glsl
struct Player {
vec3 pos;
vec3 speed;
};
src/main.rs
#[glrs::import(path = "shaders/utils.glsl", name = "Player")]
#[derive(Debug)]
struct GlPlayer;
fn main() {
dbg!(GlPlayer {
pos: glam::vec3(0., 0., 0.),
speed: glam::vec3(0., 0., 0.),
});
}