nannou icon indicating copy to clipboard operation
nannou copied to clipboard

Is render_to_texture without clearing possible? Bug?

Open dumski opened this issue 3 years ago • 3 comments

Hi, I tried to render drawings to texture (not to window) using code from example draw_capture_hi_res.rs - but I need to render another frame on top of previous frame (with no clearing). It is perfectly possible to do this in main draw function (just if you remove the draw.background() call you can render frames without clearing).

I thought it should be possible with rendering to texture but it results with black texture no matter what... Even some other shapes drawn in main window on top of that faulty texture becomes black.

You can reproduce the problem by commenting out line 103 of draw_capture_hi_res.rs example and you will get transparent output images instead of rendered drawings.

Is it a bug or I can achieve needed behaviour another way? Thanks!

dumski avatar Oct 23 '22 19:10 dumski

Hello, anyone here? ;)

dumski avatar Nov 14 '22 08:11 dumski

Perhaps your blend mode isn't set -- do you have a code sample? Commenting out line 103 is a different situation since it's the main framebuffer and is hardcoded to not be cleared.

danwilhelm avatar Nov 14 '22 08:11 danwilhelm

Perhaps you can try not having a draw.background() for the main framebuffer. Then for the texture, ensure it is cleared with a transparent alpha channel and drawn with an appropriate blend mode.

danwilhelm avatar Nov 14 '22 08:11 danwilhelm