summaryrefslogtreecommitdiff
path: root/engine/src/opengl/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/opengl/mod.rs')
-rw-r--r--engine/src/opengl/mod.rs49
1 files changed, 49 insertions, 0 deletions
diff --git a/engine/src/opengl/mod.rs b/engine/src/opengl/mod.rs
index 40f0c58..0b1bb8a 100644
--- a/engine/src/opengl/mod.rs
+++ b/engine/src/opengl/mod.rs
@@ -33,6 +33,13 @@ pub fn clear_buffers(mask: BufferClearMask)
}
}
+pub fn set_polygon_mode(face: impl Into<PolygonModeFace>, mode: impl Into<PolygonMode>)
+{
+ unsafe {
+ gl::PolygonMode(face.into() as u32, mode.into() as u32);
+ }
+}
+
pub fn enable(capacity: Capability)
{
unsafe {
@@ -56,3 +63,45 @@ pub enum Capability
DepthTest = gl::DEPTH_TEST,
MultiSample = gl::MULTISAMPLE,
}
+
+#[derive(Debug)]
+#[repr(u32)]
+pub enum PolygonMode
+{
+ Point = gl::POINT,
+ Line = gl::LINE,
+ Fill = gl::FILL,
+}
+
+impl From<crate::draw_flags::PolygonMode> for PolygonMode
+{
+ fn from(mode: crate::draw_flags::PolygonMode) -> Self
+ {
+ match mode {
+ crate::draw_flags::PolygonMode::Point => Self::Point,
+ crate::draw_flags::PolygonMode::Fill => Self::Fill,
+ crate::draw_flags::PolygonMode::Line => Self::Line,
+ }
+ }
+}
+
+#[derive(Debug)]
+#[repr(u32)]
+pub enum PolygonModeFace
+{
+ Front = gl::FRONT,
+ Back = gl::BACK,
+ FrontAndBack = gl::FRONT_AND_BACK,
+}
+
+impl From<crate::draw_flags::PolygonModeFace> for PolygonModeFace
+{
+ fn from(face: crate::draw_flags::PolygonModeFace) -> Self
+ {
+ match face {
+ crate::draw_flags::PolygonModeFace::Front => Self::Front,
+ crate::draw_flags::PolygonModeFace::Back => Self::Back,
+ crate::draw_flags::PolygonModeFace::FrontAndBack => Self::FrontAndBack,
+ }
+ }
+}