Thursday 17 March 2011

OpenGL Can Speed Things Up

On my five year old gaming PC, using OpenGL to render my scenes speeds things up a lot.

This is probably because it has a lot of graphics horsepower that is going to waste, and OpenGL enables hardware acceleration. Even with a purely 2D scene, I can get 6 FPS average on a program that runs at 4 FPS using the default Processing renderer. This much difference at low FPS is pretty big, another test I ran for high framerates confirms that it scales well (28 FPS vs 49 FPS with OpenGL). It obviously depends on your machine, but might be worth a shot.

To use OpenGL, add it to the size() function where you declare the size of your display window, like this:
size(600, 600, OPENGL)
EDIT: As JT kindly pointed out to me, P3D gives a much smoother look than the other renderers. This comes at a performance cost though, so might be good for screenshots. In my test I got 20, 28 and 49 FPS on P3D, Default and OpenGL renderers respectively.

No comments:

Post a Comment