Macro for_each_opengl_command

Source
for_each_opengl_command!() { /* proc-macro */ }
Expand description

Repeats the input for each command in the OpenGL API and Extension Registry.

§Replacements

This macro will replace some specific identifiers prefixed with a hashtag.

§The following identifiers will be replaced

gl_command_name
Will be replaced by the full command name. For example, glViewport.

gl_command_name_noprefix
Will be replaced by the command name without the “gl” prefix. For example, Viewport.

gl_command_ret_type
Will be replaced by the command return type. For example, GLuint.

gl_command_args
Will be replaced by the command arguments formatted as name: type, seperated by comma.

gl_command_arg_names
Will be replaced by the command argument names, seperated by comma.

gl_command_arg_types
Will be replaced by the command argument types, seperated by comma.

§Examples

for_each_opengl_command! {
    fn #gl_command_name()
    {
        println!("Hello from {}", stringify!(#gl_command_name));
    }
}

Would expand to the following if the only OpenGL commands were glCreateShader and glBindBuffer.

fn glCreateShader()
{
    println!("Hello from {}", stringify!(glCreateShader));
}
fn glBindBuffer()
{
    println!("Hello from {}", stringify!(glBindBuffer));
}