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 › PApplet.paint() performance
Page Index Toggle Pages: 1
PApplet.paint() performance (Read 409 times)
PApplet.paint() performance
Apr 2nd, 2008, 5:30pm
 
Hi,

 i have a processing program that is 1024x768 and i have noticed that with the default renderer the paint() method of PApplet even with a low framerate takes a lot of CPU. I think it is because it paints the whole application (screen.drawImage()), but sometimes in my application only a small area of the screen is updated, so there's no need to update it all.

Does anyone know a way to select which parts to update? I know this is somewhat strange, but performance suffers a lot and the application is not fast enough. I guess this is to avoid writting directly to the screen, and instead write on a buffer and then write this buffer, right?

With OpenGL speed is ok, but the problem is that in some computers it has some "glitches" ("internal diagonals") when  smooth is turned on. And P3D is also fast, but not as nice as default or OpenGL.

Thanks in advance
Re: PApplet.paint() performance
Reply #1 - Apr 3rd, 2008, 6:46am
 
Default = Java2D = Java's default graphics engine which is AWT or Swing or something = Slow but accurate.

the "diagonal lines" could be fixable within opengl. Check out the processing source code for the opengl jar, and see what the current impl is doing when you call "smooth". Then look online for opengl pages talking about whatever-it's-doing's problems.

I.E., if you don't like it's speed don't use the default renderer :p Processing can't do anything to speed Java2D up, it only calls functions on the default java graphics objects (where P3D does some really cool own-code stuff)
Page Index Toggle Pages: 1