summaryrefslogtreecommitdiff
path: root/engine/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/opengl')
-rw-r--r--engine/src/opengl/buffer.rs15
-rw-r--r--engine/src/opengl/mod.rs4
2 files changed, 7 insertions, 12 deletions
diff --git a/engine/src/opengl/buffer.rs b/engine/src/opengl/buffer.rs
index 3a4ecf0..1622804 100644
--- a/engine/src/opengl/buffer.rs
+++ b/engine/src/opengl/buffer.rs
@@ -6,9 +6,8 @@ use crate::opengl::currently_bound::CurrentlyBound;
#[derive(Debug)]
pub struct Buffer<Item, ModeT: Mode>
{
- buffer: gl::types::GLuint,
- _item_pd: PhantomData<Item>,
- _mode_pd: PhantomData<ModeT>,
+ buf: gl::types::GLuint,
+ _pd: PhantomData<(Item, ModeT)>,
}
impl<Item, ModeT: Mode> Buffer<Item, ModeT>
@@ -21,11 +20,7 @@ impl<Item, ModeT: Mode> Buffer<Item, ModeT>
gl::GenBuffers(1, &mut buffer);
};
- Self {
- buffer,
- _item_pd: PhantomData,
- _mode_pd: PhantomData,
- }
+ Self { buf: buffer, _pd: PhantomData }
}
#[allow(clippy::inline_always)]
@@ -33,7 +28,7 @@ impl<Item, ModeT: Mode> Buffer<Item, ModeT>
pub fn bind(&self, cb: impl FnOnce(CurrentlyBound<'_, Self>))
{
unsafe {
- gl::BindBuffer(ModeT::GL_ENUM, self.buffer);
+ gl::BindBuffer(ModeT::GL_ENUM, self.buf);
}
// SAFETY: The buffer object is bound above
@@ -63,7 +58,7 @@ impl<Item, ModeT: Mode> Drop for Buffer<Item, ModeT>
{
#[allow(clippy::cast_possible_wrap, clippy::cast_possible_truncation)]
unsafe {
- gl::DeleteBuffers(1, &self.buffer);
+ gl::DeleteBuffers(1, &self.buf);
}
}
}
diff --git a/engine/src/opengl/mod.rs b/engine/src/opengl/mod.rs
index d58ca50..6898c49 100644
--- a/engine/src/opengl/mod.rs
+++ b/engine/src/opengl/mod.rs
@@ -1,6 +1,6 @@
use bitflags::bitflags;
-use glfw::WindowSize;
+use crate::data_types::dimens::Dimens;
use crate::vector::Vec2;
pub mod buffer;
@@ -14,7 +14,7 @@ mod util;
#[cfg(feature = "debug")]
pub mod debug;
-pub fn set_viewport(position: &Vec2<u32>, size: &WindowSize)
+pub fn set_viewport(position: &Vec2<u32>, size: Dimens<u32>)
{
unsafe {
#[allow(clippy::cast_possible_wrap)]