summaryrefslogtreecommitdiff
path: root/engine/src/opengl/currently_bound.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-10-13 23:32:00 +0200
committerHampusM <hampus@hampusmat.com>2023-10-13 23:32:00 +0200
commit12f48046b2606fc77a1312a6d5e5fc7ff9feff88 (patch)
tree644f4abd6785a5f0c066c7fbadcfc5e820a41ebf /engine/src/opengl/currently_bound.rs
parentcfa73b1ea42fa491ff9e00bb5efb5e5a5d860578 (diff)
refactor(engine): move uses of OpenGL to OpenGL module
Diffstat (limited to 'engine/src/opengl/currently_bound.rs')
-rw-r--r--engine/src/opengl/currently_bound.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/engine/src/opengl/currently_bound.rs b/engine/src/opengl/currently_bound.rs
new file mode 100644
index 0000000..eefa239
--- /dev/null
+++ b/engine/src/opengl/currently_bound.rs
@@ -0,0 +1,22 @@
+use std::marker::PhantomData;
+
+/// A token signifying a OpenGL object is currently bound.
+pub struct CurrentlyBound<'token, Object>
+{
+ _token: PhantomData<&'token Object>,
+}
+
+impl<'token, Object> CurrentlyBound<'token, Object>
+{
+ /// Returns a new `CurrentlyBound`.
+ ///
+ /// # Safety
+ /// A object must actually be currently bound. Otherwise, UB can occur.
+ #[must_use]
+ pub unsafe fn new() -> Self
+ {
+ Self {
+ _token: PhantomData,
+ }
+ }
+}