1 | // Copyright 2015 Brendan Zabarauskas and the gl-rs developers |
2 | // |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | // you may not use this file except in compliance with the License. |
5 | // You may obtain a copy of the License at |
6 | // |
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | // |
9 | // Unless required by applicable law or agreed to in writing, software |
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | // See the License for the specific language governing permissions and |
13 | // limitations under the License. |
14 | |
15 | //! An OpenGL bindings generator. It defines a function named `generate_bindings` which can be |
16 | //! used to generate all constants and functions of a given OpenGL version. |
17 | //! |
18 | //! # Example |
19 | //! |
20 | //! In `build.rs`: |
21 | //! |
22 | //! ```no_run |
23 | //! extern crate gl_generator; |
24 | //! |
25 | //! use gl_generator::{Registry, Api, Profile, Fallbacks, GlobalGenerator}; |
26 | //! use std::env; |
27 | //! use std::fs::File; |
28 | //! use std::path::Path; |
29 | //! |
30 | //! fn main() { |
31 | //! let dest = env::var("OUT_DIR" ).unwrap(); |
32 | //! let mut file = File::create(&Path::new(&dest).join("gl_bindings.rs" )).unwrap(); |
33 | //! |
34 | //! Registry::new(Api::Gl, (4, 5), Profile::Core, Fallbacks::All, []) |
35 | //! .write_bindings(GlobalGenerator, &mut file) |
36 | //! .unwrap(); |
37 | //! } |
38 | //! ``` |
39 | //! |
40 | //! In your project: |
41 | //! |
42 | //! ```ignore |
43 | //! include!(concat!(env!("OUT_DIR" ), "/gl_bindings.rs" )); |
44 | //! ``` |
45 | //! |
46 | //! # About EGL |
47 | //! |
48 | //! When you generate bindings for EGL, the following platform-specific types must be declared |
49 | //! *at the same level where you include the bindings*: |
50 | //! |
51 | //! - `khronos_utime_nanoseconds_t` |
52 | //! - `khronos_uint64_t` |
53 | //! - `khronos_ssize_t` |
54 | //! - `EGLNativeDisplayType` |
55 | //! - `EGLNativePixmapType` |
56 | //! - `EGLNativeWindowType` |
57 | //! - `EGLint` |
58 | //! - `NativeDisplayType` |
59 | //! - `NativePixmapType` |
60 | //! - `NativeWindowType` |
61 | //! |
62 | |
63 | #[macro_use ] |
64 | extern crate log; |
65 | extern crate xml; |
66 | |
67 | #[cfg (feature = "unstable_generator_utils" )] |
68 | pub mod generators; |
69 | #[cfg (not(feature = "unstable_generator_utils" ))] |
70 | mod generators; |
71 | |
72 | mod registry; |
73 | |
74 | pub use generators::debug_struct_gen::DebugStructGenerator; |
75 | pub use generators::global_gen::GlobalGenerator; |
76 | pub use generators::static_gen::StaticGenerator; |
77 | pub use generators::static_struct_gen::StaticStructGenerator; |
78 | pub use generators::struct_gen::StructGenerator; |
79 | pub use generators::Generator; |
80 | |
81 | pub use registry::*; |
82 | |