Crates.io | glossy |
lib.rs | glossy |
version | 0.2.0 |
source | src |
created_at | 2016-10-24 11:03:29.365725 |
updated_at | 2016-10-25 08:56:09.754075 |
description | A compile-time GLSL shader loader with `#include` support. |
homepage | |
repository | https://github.com/mathewv/rust-glossy |
max_upload_size | |
id | 6991 |
size | 1,915 |
A GLSL source loading crate for Rust which supports the #include
directive and shader optimization at compile time via
glsl-optimizer.
In build script build.rs
:
extern crate glossy_codegen as glsl;
void main() {
glsl::Config::new(glsl::Language::OpenGl)
.vertex("shaders/*.vert")
.fragment("shaders/*.frag")
.include("shaders/include/*")
.optimize()
.build();
}
In Rust source file main.rs
:
#[macro_use]
extern crate glossy;
extern crate glium;
void main() {
// ...
glium::Program::from_source(gl,
shader!("sprite.vert"),
shader!("sprite.frag"),
None)
.unwrap();
// ...
}
In shader source file shader.frag
:
#version 120
#include "common.glsl"
void main() {
float v = common_func(common_uniform);
// ...
}