@@ -33,33 +33,34 @@ Create a `build.rs` to pull your specific version/API:
3333``` rust
3434extern crate gl_generator;
3535
36- use gl_generator :: {Fallbacks , GlobalGenerator , Api , Profile };
36+ use gl_generator :: {Registry , Api , Profile , Fallbacks , GlobalGenerator };
3737use std :: env;
3838use std :: fs :: File ;
3939use std :: path :: Path ;
4040
4141fn main () {
4242 let dest = env :: var (" OUT_DIR" ). unwrap ();
43- let mut file = File :: create (& Path :: new (& dest ). join (" bindings .rs" )). unwrap ();
43+ let mut file = File :: create (& Path :: new (& dest ). join (" gl_bindings .rs" )). unwrap ();
4444
45- gl_generator :: generate_bindings (GlobalGenerator , Api :: Gl , Fallbacks :: All ,
46- vec! [], " 4.5" , Profile :: Core , & mut file ). unwrap ();
45+ Registry :: new (Api :: Gl , (4 , 5 ), Profile :: Core , Fallbacks :: All , [])
46+ . write_bindings (GlobalGenerator , & mut file )
47+ . unwrap ();
4748}
4849```
4950
5051Then use it like this:
5152
5253``` rust
53- mod gles {
54+ mod gl {
5455 include! (concat! (env! (" OUT_DIR" ), " /bindings.rs" ));
5556}
5657
57- /*
58- * Simple loading example
59- */
58+ /// Simple loading example
6059fn main () {
61- // Assuming window is GLFW, initialized, and made current
62- gles :: load_with (| s | window . get_proc_address (s ));
60+ let window = ... ;
61+
62+ // Assuming `window` is GLFW: initialize, and made current
63+ gl :: load_with (| s | window . get_proc_address (s ));
6364}
6465```
6566
@@ -105,11 +106,8 @@ OpenGL 1.1 on Windows, you will need to add
105106### Custom Generators
106107
107108The ` gl_generator ` crate is extensible. This is a niche feature useful only in
108- very rare cases. To create a custom generator, [ create a new plugin
109- crate] ( http://doc.rust-lang.org/guide-plugin.html#syntax-extensions ) which
110- depends on ` gl_generator ` . Then, implement the ` gl_generator::Generator ` trait
111- and in your plugin registrar, register a function which calls
112- ` gl_generator::generate_bindings ` with your custom generator and its name.
109+ very rare cases. To create a custom generator, implement the
110+ ` gl_generator::generators::Generator ` trait.
113111
114112## Extra features
115113
@@ -122,14 +120,16 @@ also attempt to load `glGenFramebuffersEXT` as a fallback.
122120### vX.X.X
123121
124122- Rename ` Ns ` to ` API ` , and expose at the top level
125- - Use ` Api ` for ` Extension::supported ` and ` Filter::api ` fields
126- - Remove ` source ` argument from ` generate_bindings ` , removing the need for
127- clients to depend on the ` khronos_api ` crate
128- - Add ` Profile ` enum for specifying the API profile, and change the ` source `
129- argument to use it instead of a string
130- - Remove ` features ` and ` extensions ` fields from ` Registry `
131- - Hide ` registry::{Feature, Filter, Require, Remove, Extension} ` from the public API
132- - Move ` registry::{Fallbacks, Api, Profile} ` to top level module
123+ - Remove the need for clients to depend on the ` khronos_api ` crate by
124+ determining the XML source based on the requested ` API `
125+ - Use a ` (u8, u8) ` instead of a string for the target version number
126+ - Use a ` Profile ` enum instead of a string for the profile
127+ - Remove unused fields from ` Registry `
128+ - Accept types satisfying ` AsRef<[&str]> ` for extension lists
129+ - Separate parsing and generation stages in API
130+ - Hide ` registry::{Feature, Filter, Require, Remove, Extension} ` types from the
131+ public API
132+ - Move ` registry::{Fallbacks, Api, Profile} ` types to top level module
133133
134134### v0.4.2
135135
0 commit comments