Skip to content

Commit

Permalink
Clear OpenGL cache on renderer clear
Browse files Browse the repository at this point in the history
  • Loading branch information
Speykious committed Jul 14, 2024
1 parent 4f0af0f commit 9dcfb56
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions inox2d-opengl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ pub struct GlCache {
}

impl GlCache {
pub fn clear(&mut self) {
*self = Self::default();
}

pub fn update_camera(&mut self, camera: &Camera) -> bool {
if let Some(prev_camera) = &mut self.camera {
let mut changed = false;
Expand Down Expand Up @@ -395,6 +399,8 @@ impl InoxRenderer for OpenglRenderer {
}

fn clear(&self) {
self.cache.borrow_mut().clear();

unsafe {
self.gl.clear(glow::COLOR_BUFFER_BIT);
}
Expand Down

0 comments on commit 9dcfb56

Please sign in to comment.