I'm trying to teach a creative coding course using love2d instead of processing or p5js as I have done in the past. A common thing that we do is draw to a canvas repeatedly, without clearing the canvas between frames. For games, it makes sense that the background is automatically cleared each frame in love2d - is there a way to disable that behavior?
Thanks!
Rob
How to NOT clear the background automatically
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- slime
- Solid Snayke
- Posts: 3166
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: How to NOT clear the background automatically
You can use a Canvas for that, by drawing to the canvas every frame without explicitly calling love.graphics.clear.
It is technically possible to modify love.run to not clear the screen backbuffer as well, but I strongly recommend you not do that. The screen backbuffer is double-buffered by the OS on most systems, which means it keeps different copies for different frames so you won't have the behaviour you'd expect. The OS will also trash the contents of the backbuffer when the user does different things (like covering the app window with another, or minimizing it, etc.)
It is technically possible to modify love.run to not clear the screen backbuffer as well, but I strongly recommend you not do that. The screen backbuffer is double-buffered by the OS on most systems, which means it keeps different copies for different frames so you won't have the behaviour you'd expect. The OS will also trash the contents of the backbuffer when the user does different things (like covering the app window with another, or minimizing it, etc.)
Who is online
Users browsing this forum: Google [Bot] and 5 guests