2020-02-16 23:32:35 +00:00
|
|
|
// Trivial wrappers around GLESv2 C functions that should be safe
|
|
|
|
|
2020-02-16 23:44:01 +00:00
|
|
|
use glam::{Mat4, Vec3, Vec4};
|
|
|
|
|
2020-02-16 23:32:35 +00:00
|
|
|
pub fn clear_color (r: f32, g: f32, b: f32, a: f32) {
|
|
|
|
unsafe {
|
|
|
|
gl::ClearColor (1.0f32, 1.0f32, 1.0f32, 1.0f32);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn clear (flags: u32) {
|
|
|
|
unsafe {
|
|
|
|
gl::Clear (flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn disable (constant: u32) {
|
|
|
|
unsafe {
|
|
|
|
gl::Disable (constant);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn enable (constant: u32) {
|
|
|
|
unsafe {
|
|
|
|
gl::Enable (constant);
|
|
|
|
}
|
|
|
|
}
|
2020-02-16 23:44:01 +00:00
|
|
|
|
|
|
|
pub fn uniform_3fv (uni: i32, v: &Vec3) {
|
|
|
|
unsafe {
|
|
|
|
gl::Uniform3fv (uni, 1, v as *const Vec3 as *const f32);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn uniform_4fv (uni: i32, v: &Vec4) {
|
|
|
|
unsafe {
|
|
|
|
gl::Uniform4fv (uni, 1, v as *const Vec4 as *const f32);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn uniform_matrix_4fv (uni: i32, m: &Mat4) {
|
|
|
|
const FALSE_U8: u8 = 0;
|
|
|
|
|
|
|
|
unsafe {
|
|
|
|
gl::UniformMatrix4fv (uni, 1, FALSE_U8, m as *const Mat4 as *const f32);
|
|
|
|
}
|
|
|
|
}
|