emilk / egui

egui: an easy-to-use immediate mode GUI in Rust that runs on both web and native
https://www.egui.rs/
Apache License 2.0
22.47k stars 1.6k forks source link

bug: mismatch between texture size and texel count #5061

Closed briheet closed 2 months ago

briheet commented 2 months ago

Describe the bug Using egui and eframe to hook up a webcam reading. Converting .yuv to color image via harcoding the width and height and providing pixels through from_rgb(). Using load_texture() could be an issue as stated with a sign in !docsrs

thread 'main' panicked at /home/briheet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/egui_glow-0.28.1/src/painter.rs:519:17: assertion ``left == right`` failed: Mismatch between texture size and texel count left: 921600 right: 921895 note: run with ``RUST_BACKTRACE=1`` environment variable to display a backtrace

Expected behavior Ui should pop up and show the cam data. Right now the ui can get .yuv and can be seen via feh.

Screenshots 2024-09-02-22:35:36-screenshot

Desktop (please complete the following information):

emilk commented 2 months ago

This is likely a user error - you're setting up a ColorImage (or similar) with too many pixels

briheet commented 2 months ago

Found image width and height assert with pixel len, made cam resolution down with v4l-ctl as 640 and 480 with YUYV and it works, thanks. v4l2-ctl --set-fmt-video=width=640,height=480,pixelformat=YUYV