Articles

Navigation ( archives ›› 2008 ›› December ›› 30 ›› Using hardware acceleration for Java2D )

Using hardware acceleration for Java2D

Posted on December 30, 2008, 10:05 am EST

Java2D is the main thing that drives Swing rendering, and Java2D does not benefit from hardware acceleration by default on any platform. Java2D does offer hardware acceleration through its OpenGL and Direct3D rendering pipelines which are not enabled by default. It is only available on the Java SE 5+.

How to enable hardware acceleration for Java2D?

Within your command-line flags, add the following:

OpenGL

CODE:
-Dsun.java2d.opengl=true

Direct3D

CODE:
-Dsun.java2d.d3d=true

A side note, when dealing with images and complicated paintings within Swing, don't let this acceleration stop you from optimizing your Swing rendering. For instance, the use of clips, compatible images, managed images, intermediate images, will help improve performance greatly. I might do a blog post regarding how to improve custom rendering in Swing.

About this Article:

Comments (0) - Add yours, or View the replies

Categoy (Java)

Views (1530)

Digg it: Digg this article