generated from lks/eframe_template_android
Clear waterfall texture buffer at startup
This commit is contained in:
parent
4724d23459
commit
d1271c1f7d
@ -17,6 +17,25 @@ unsafe fn check_for_gl_errors(gl: &glow::Context, msg: &str) {
|
|||||||
log::error!("Waterfall {}: GL ERROR {} ({:#X})", msg, err, err);
|
log::error!("Waterfall {}: GL ERROR {} ({:#X})", msg, err, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unsafe fn clear_texture(gl: &glow::Context, bytes_per_row: usize, n_rows: usize) {
|
||||||
|
let blank_line = vec![0_u8; bytes_per_row];
|
||||||
|
for offset in 0..n_rows {
|
||||||
|
unsafe {
|
||||||
|
gl.tex_sub_image_2d(
|
||||||
|
glow::TEXTURE_2D,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
offset as i32,
|
||||||
|
bytes_per_row as i32,
|
||||||
|
1,
|
||||||
|
glow::RED,
|
||||||
|
glow::UNSIGNED_BYTE,
|
||||||
|
PixelUnpackData::Slice(&blank_line),
|
||||||
|
);
|
||||||
|
check_for_gl_errors(&gl, &format!("clear texture with offset {}", offset));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
use crate::app::turbo_colormap;
|
use crate::app::turbo_colormap;
|
||||||
|
|
||||||
@ -200,6 +219,9 @@ impl Waterfall {
|
|||||||
);
|
);
|
||||||
check_for_gl_errors(&gl, "Initializing Texture");
|
check_for_gl_errors(&gl, "Initializing Texture");
|
||||||
|
|
||||||
|
// Clear the texture
|
||||||
|
clear_texture(gl, width, height);
|
||||||
|
|
||||||
let color_lut = gl
|
let color_lut = gl
|
||||||
.create_texture()
|
.create_texture()
|
||||||
.expect("Waterfall: could not create LUT");
|
.expect("Waterfall: could not create LUT");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user