[−][src]Macro glium::program
Builds a program depending on the GLSL version supported by the backend.
This is implemented with successive calls to is_glsl_version_supported()
.
Returns a glium::program::ProgramChooserCreationError
.
Example
# #[macro_use]
# extern crate glium;
# fn main() {
# let display: glium::Display = unsafe { std::mem::MaybeUninit::uninit().assume_init() };
let program = program!(&display,
300 => {
vertex: r#"
#version 300
fn main() {
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
}
"#,
fragment: r#"
#version 300
out vec4 color;
fn main() {
color = vec4(1.0, 1.0, 0.0, 1.0);
}
"#,
},
110 => {
vertex: r#"
#version 110
fn main() {
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
}
"#,
fragment: r#"
#version 110
fn main() {
gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
}
"#,
},
300 es => {
vertex: r#"
#version 110
fn main() {
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
}
"#,
fragment: r#"
#version 110
fn main() {
gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
}
"#,
},
);
# }