summaryrefslogtreecommitdiff
path: root/engine/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/opengl')
-rw-r--r--engine/src/opengl/mod.rs22
-rw-r--r--engine/src/opengl/texture.rs6
2 files changed, 24 insertions, 4 deletions
diff --git a/engine/src/opengl/mod.rs b/engine/src/opengl/mod.rs
index a4d3959..53e0120 100644
--- a/engine/src/opengl/mod.rs
+++ b/engine/src/opengl/mod.rs
@@ -1,4 +1,5 @@
use bitflags::bitflags;
+use gl::types::GLint;
use crate::data_types::dimens::Dimens;
use crate::vector::Vec2;
@@ -11,7 +12,6 @@ pub mod vertex_array;
mod util;
-#[cfg(feature = "debug")]
pub mod debug;
pub fn set_viewport(position: Vec2<u32>, size: Dimens<u32>)
@@ -48,6 +48,17 @@ pub fn enable(capacity: Capability)
}
}
+pub fn get_context_flags() -> ContextFlags
+{
+ let mut context_flags: GLint = 0;
+
+ unsafe {
+ gl::GetIntegerv(gl::CONTEXT_FLAGS as u32, &mut context_flags);
+ }
+
+ ContextFlags::from_bits_truncate(context_flags as u32)
+}
+
bitflags! {
#[derive(Debug, Clone, Copy)]
pub struct BufferClearMask: u32 {
@@ -106,3 +117,12 @@ impl From<crate::draw_flags::PolygonModeFace> for PolygonModeFace
}
}
}
+
+bitflags! {
+#[derive(Debug, Clone, Copy)]
+pub struct ContextFlags: u32 {
+ const FORWARD_COMPATIBLE = gl::CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
+ const DEBUG = gl::CONTEXT_FLAG_DEBUG_BIT;
+ const ROBUST_ACCESS = gl::CONTEXT_FLAG_ROBUST_ACCESS_BIT;
+}
+}
diff --git a/engine/src/opengl/texture.rs b/engine/src/opengl/texture.rs
index 074ade7..52c8554 100644
--- a/engine/src/opengl/texture.rs
+++ b/engine/src/opengl/texture.rs
@@ -1,5 +1,5 @@
use crate::data_types::dimens::Dimens;
-use crate::texture::{Id, Properties};
+use crate::texture::Properties;
#[derive(Debug)]
pub struct Texture
@@ -224,8 +224,8 @@ macro_rules! texture_unit_enum {
}
}
- pub fn from_texture_id(texture_id: Id) -> Option<Self> {
- match texture_id.into_inner() {
+ pub fn from_num(num: usize) -> Option<Self> {
+ match num {
#(
N => Some(Self::No~N),
)*