Fix texture offset using wrong dimension

This commit is contained in:
Lucas Schumacher 2024-05-13 15:33:52 -04:00
parent 6445949083
commit 54826d50a6

View File

@ -29,6 +29,7 @@ pub struct Waterfall {
ebo: glow::Buffer, ebo: glow::Buffer,
offset: usize, offset: usize,
width: usize, width: usize,
height: usize,
fft_in: Receiver<Vec<u8>>, fft_in: Receiver<Vec<u8>>,
} }
@ -82,8 +83,8 @@ impl Waterfall {
glow::UNSIGNED_BYTE, glow::UNSIGNED_BYTE,
PixelUnpackData::Slice(&fft), PixelUnpackData::Slice(&fft),
); );
check_for_gl_errors(&gl, "update texture"); check_for_gl_errors(&gl, &format!("update texture with offset {}", self.offset));
self.offset = (self.offset + 1) % self.width; self.offset = (self.offset + 1) % self.height;
} }
if let Some(uniform) = gl.get_uniform_location(self.program, "offset") { if let Some(uniform) = gl.get_uniform_location(self.program, "offset") {
@ -317,6 +318,7 @@ impl Waterfall {
ebo, ebo,
offset: 0_usize, offset: 0_usize,
width, width,
height,
fft_in, fft_in,
} }
} }