|
13 | 13 | // See the License for the specific language governing permissions and
|
14 | 14 | // limitations under the License.
|
15 | 15 |
|
16 |
| -//! # gl_generator |
| 16 | +//! An OpenGL bindings generator. It defines a function named `generate_bindings` which can be |
| 17 | +//! used to generate all constants and functions of a given OpenGL version. |
17 | 18 | //!
|
18 |
| -//! `gl_generator` is an OpenGL bindings generator. It defines a function |
19 |
| -//! named `generate_bindings` which can be used to generate all constants |
20 |
| -//! and functions of a given OpenGL version. |
21 |
| -//! |
22 |
| -//! ## Example |
| 19 | +//! # Example |
23 | 20 | //!
|
24 | 21 | //! In `build.rs`:
|
25 | 22 | //!
|
|
46 | 43 | //! include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs"));
|
47 | 44 | //! ```
|
48 | 45 | //!
|
49 |
| -//! ## Arguments |
50 |
| -//! |
51 |
| -//! Each field can be specified at most once, or not at all. If the field is not |
52 |
| -//! specified, then a default value will be used. |
53 |
| -//! |
54 |
| -//! - `api`: The API to generate. Can be either `"gl"`, `"gles1"`, `"gles2"`, |
55 |
| -//! `"wgl"`, `"glx"`, `"egl"`. Defaults to `"gl"`. |
56 |
| -//! - `profile`: Can be either `"core"` or `"compatibility"`. Defaults to |
57 |
| -//! `"core"`. `"core"` will only include all functions supported by the |
58 |
| -//! requested version it self, while `"compatibility"` will include all the |
59 |
| -//! functions from previous versions as well. |
60 |
| -//! - `version`: The requested API version. This is usually in the form |
61 |
| -//! `"major.minor"`. Defaults to `"1.0"` |
62 |
| -//! - `generator`: The type of loader to generate. Can be either `"static"`, |
63 |
| -//! `"global"`, or `"struct"`. Defaults to `"static"`. |
64 |
| -//! - `extensions`: Extra extensions to include in the bindings. These are |
65 |
| -//! specified as a list of strings. Defaults to `[]`. |
66 |
| -//! |
67 |
| -//! ## About EGL |
| 46 | +//! # About EGL |
68 | 47 | //!
|
69 | 48 | //! When you generate bindings for EGL, the following platform-specific types must be declared
|
70 | 49 | //! *at the same level where you include the bindings*:
|
@@ -102,7 +81,19 @@ pub mod generators;
|
102 | 81 | #[allow(dead_code)]
|
103 | 82 | pub mod registry;
|
104 | 83 |
|
105 |
| -/// Public function that generates Rust source code. |
| 84 | +/// Generate OpenGL bindings using the specified generator |
| 85 | +/// |
| 86 | +/// # Arguments |
| 87 | +/// |
| 88 | +/// - `generator`: The type of loader to generate. |
| 89 | +/// - `api`: The API to generate. |
| 90 | +/// - `profile`: Can be either `"core"` or `"compatibility"`. `"core"` will only include all |
| 91 | +/// functions supported by the requested version it self, while `"compatibility"` will include |
| 92 | +/// all the functions from previous versions as well. |
| 93 | +/// - `version`: The requested API version. This is usually in the form `"major.minor"`. |
| 94 | +/// - `extensions`: A list of extra extensions to include in the bindings. |
| 95 | +/// - `dest`: Where to write the generated rust source code to |
| 96 | +/// |
106 | 97 | pub fn generate_bindings<G, W>(generator: G, api: registry::Api, fallbacks: Fallbacks,
|
107 | 98 | extensions: Vec<String>, version: &str, profile: &str,
|
108 | 99 | dest: &mut W) -> io::Result<()> where G: Generator, W: io::Write
|
|
0 commit comments