Crate gl_generator [−] [src]
gl_generator
gl_generator is an OpenGL bindings generator. It defines a function
named generate_bindings which can be used to generate all constants
and functions of a given OpenGL version.
Example
In build.rs:
extern crate gl_generator; extern crate khronos_api; use std::env; use std::fs::File; use std::path::Path; fn main() { let dest = env::var("OUT_DIR").unwrap(); let mut file = File::create(&Path::new(&dest).join("gl_bindings.rs")).unwrap(); gl_generator::generate_bindings(gl_generator::GlobalGenerator, gl_generator::registry::Ns::Gl, gl_generator::Fallbacks::All, khronos_api::GL_XML, vec![], "4.5", "core", &mut file).unwrap(); }
In your project:
include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs"));
Arguments
Each field can be specified at most once, or not at all. If the field is not specified, then a default value will be used.
api: The API to generate. Can be either"gl","gles1","gles2","wgl","glx","egl". Defaults to"gl".profile: Can be either"core"or"compatibility". Defaults to"core"."core"will only include all functions supported by the requested version it self, while"compatibility"will include all the functions from previous versions as well.version: The requested API version. This is usually in the form"major.minor". Defaults to"1.0"generator: The type of loader to generate. Can be either"static","global", or"struct". Defaults to"static".extensions: Extra extensions to include in the bindings. These are specified as a list of strings. Defaults to[].
About EGL
When you generate bindings for EGL, the following platform-specific types must be declared at the same level where you include the bindings:
khronos_utime_nanoseconds_tkhronos_uint64_tkhronos_ssize_tEGLNativeDisplayTypeEGLNativePixmapTypeEGLNativeWindowTypeEGLintNativeDisplayTypeNativePixmapTypeNativeWindowType
Reexports
pub use registry::Fallbacks; |
pub use generators::debug_struct_gen::DebugStructGenerator; |
pub use generators::global_gen::GlobalGenerator; |
pub use generators::static_gen::StaticGenerator; |
pub use generators::static_struct_gen::StaticStructGenerator; |
pub use generators::struct_gen::StructGenerator; |
Modules
| generators | |
| registry |
Functions
| generate_bindings |
Public function that generates Rust source code. |