glossy 0.2.0

A compile-time GLSL shader loader with `#include` support.
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented1 out of 1 items with examples
  • Size
  • Source code size: 2.06 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.09 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • elizagamedev/rust-glossy
    9 1 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • elizagamedev

Glossy is a GLSL source loading crate for Rust which supports the #include directive and shader optimization at compile time via glsl-optimizer.

Refer to the GitHub repository for more information.

Example Usage

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);
    // ...
}