We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Help with background()
Page Index Toggle Pages: 1
Help with background() (Read 568 times)
Help with background()
Mar 20th, 2010, 1:44pm
 
Hi all,

Im using a Wii remote and have an ellipse following the IR coordinates, to show the user what they are pointing at. The problem is, I need to use background() to constantly erase the previous points. This messes up several programs i have written, because various classes etc. are drawn to the screen and this background() erases them.

Is there a way around this?

I have tried drawing the classes to off screen buffers, but cant get them working with JAVA2D, and therefore they don't smooth() properly and look terrible.

Many thanks.
Re: Help with background()
Reply #1 - Mar 20th, 2010, 2:59pm
 
background() is the only clean/simple way to go... In classical Processing, the whole sketch's surface is redraw on each draw() call.

Well, you can do a partial erase of only the previous position of your ellipse. In old video games, the idea was to capture the portion of image where the sprite (the ellipse) will be drawn, then show the sprite, then restore the saved portion of image.
Page Index Toggle Pages: 1