clear background not working
maybe i am thinking about this wrong, but my expectation for this would be that the line would stay(not be cleared) after every frame. is this a wrong expectation?
use macroquad::prelude::*;
#[macroquad::main("game")]
async fn main() {
let mut y = 100.0;
loop {
//clear_background(RED);
draw_line(50.0, y, 250.0, y, 15.0, BLUE);
y = y + 1.0;
next_frame().await
}
}
Its a correct expectation, but, unfortunately, its not implemented :(
Unfortunately, some platforms do not really support this, and this should be a special case in macroquad. Macroquad should detect that no clear was used and switch from rendering to the screen to rendering to a buffer.
Probably the best solution - show some kind of a warning/error when clear got lost.
For details check this answer: https://stackoverflow.com/a/27353240
Or should i keep this open?
It looks like a legit issue to me, lets's keep it open!
I'd say you should do clear_background() outside of the loop, so it only gets called once?
Any update on this? I've been trying to find workarounds, but no sucess so far.
Any update on this? I've been trying to find workarounds, but no sucess so far.
a common workaround is to render into a texture and draw this texture each frame, while updating the texture's content only when required
And is there how to change the draw target for functions of the shapes module, so that it draw to a texture instead of the screen? Or do I have to do the per pixel manipulation of the texture?
Yes, you use a render target, this example might help: https://github.com/not-fl3/macroquad/blob/master/examples/post_processing.rs