You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Texture2d::from_rgba8 and, consequently, Texture2d::from_image completely ignore the default_filter_mode setting.
Reproducible Example
The following code shows the example
#[macroquad::main("Blurry")]asyncfnmain(){set_default_filter_mode(FilterMode::Nearest);let t = Texture2D::from_rgba8(3,3,&[255,255,255,255,0,0,0,0,255,255,255,255,0,0,0,0,255,255,255,255,0,0,0,0,255,255,255,255,0,0,0,0,255,255,255,255,]);/* Uncomment to get the intended result */// t.set_filter(FilterMode::Nearest);loop{clear_background(GRAY);draw_texture_ex(&t,0.0,0.0,WHITE,DrawTextureParams{dest_size:Some(vec2(400.0,400.0)),
..Default::default()});next_frame().await;}}
The Fix
I can work on the fix if it that behaviour is unintended. I believe it's pretty simple:
All Texture2d creation stuff eventually boils down to calling Texture2d::from_rgba8
To leverage the delegation pattern, one should simply move .set_filter call from from_file_with_format to Texure2d::from_rgba8
The text was updated successfully, but these errors were encountered:
The problem
Texture2d::from_rgba8
and, consequently,Texture2d::from_image
completely ignore thedefault_filter_mode
setting.Reproducible Example
The following code shows the example
The Fix
I can work on the fix if it that behaviour is unintended. I believe it's pretty simple:
Texture2d::from_rgba8
.set_filter
call fromfrom_file_with_format
toTexure2d::from_rgba8
The text was updated successfully, but these errors were encountered: