use bitflags::bitflags; use crate::data_types::dimens::Dimens; use crate::vector::Vec2; pub mod buffer; pub mod shader; pub mod texture; pub mod vertex_array; mod util; #[cfg(feature = "debug")] pub mod debug; pub fn set_viewport(position: Vec2, size: Dimens) { unsafe { #[allow(clippy::cast_possible_wrap)] gl::Viewport( position.x as i32, position.y as i32, size.width as i32, size.height as i32, ); } } pub fn clear_buffers(mask: BufferClearMask) { unsafe { gl::Clear(mask.bits()); } } pub fn enable(capacity: Capability) { unsafe { gl::Enable(capacity as u32); } } bitflags! { #[derive(Debug, Clone, Copy)] pub struct BufferClearMask: u32 { const COLOR = gl::COLOR_BUFFER_BIT; const DEPTH = gl::DEPTH_BUFFER_BIT; const STENCIL = gl::STENCIL_BUFFER_BIT; } } #[derive(Debug)] #[repr(u32)] pub enum Capability { DepthTest = gl::DEPTH_TEST, MultiSample = gl::MULTISAMPLE, }