diff options
Diffstat (limited to 'engine/src/opengl/buffer.rs')
-rw-r--r-- | engine/src/opengl/buffer.rs | 15 |
1 files changed, 5 insertions, 10 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); } } } |