title: Java Hardware Acceleration
body: <p>I have been spending some time looking into the hardware acceleration features of Java, and I am still a bit confused as none of the sites that I found online directly and clearly answered some of the questions I have. So here are the questions I have for hardware acceleration in Java:</p>
  
  <p>1) In Eclipse version 3.6.0, with the most recent Java update for Mac OS X (1.6u10 I think), is hardware acceleration enabled by default? I read somewhere that </p>
  
  <pre><code>someCanvas.getGraphicsConfiguration().getBufferCapabilities().isPageFlipping()
  </code></pre>
  
  <p>is supposed to give an indication of whether or not hardware acceleration is enabled, and my program reports back true when that is run on my main Canvas instance for drawing to. If my hardware acceleration is not enabled now, or by default, what would I have to do to enable it?</p>
  
  <p>2) I have seen a couple articles here and there about the difference between a BufferedImage and VolatileImage, mainly saying that VolatileImage is the hardware accelerated image and is stored in VRAM for fast copy-from operations. However, I have also found some instances where BufferedImage is said to be hardware accelerated as well. Is BufferedImage hardware accelerated as well in my environment? What would be the advantage of using a VolatileImage if both types are hardware accelerated? My main assumption for the advantage of having a VolatileImage in the case of both having acceleration is that VolatileImage is able to detect when its VRAM has been dumped. But if BufferedImage also support acceleration now, would it not have the same kind of detection built into it as well, just hidden from the user, in case that the memory is dumped?</p>
  
  <p>3) Is there any advantage to using</p>
  
  <pre><code>someGraphicsConfiguration.getCompatibleImage/getCompatibleVolatileImage()
  </code></pre>
  
  <p>as opposed to</p>
  
  <pre><code>ImageIO.read()
  </code></pre>
  
  <p>In a tutorial I have been reading for some general concepts about setting up the rendering window properly (<a href="http://www.cokeandcode.com/info/tut2d.html">tutorial</a>) it uses the getCompatibleImage method, which I believe returns a BufferedImage, to get their "hardware accelerated" images for fast drawing, which ties into question 2 about if it is hardware accelerated.</p>
  
  <p>4) This is less hardware acceleration, but it is something I have been curious about: do I need to order which graphics get drawn? I know that when using OpenGL via C/C++ it is best to make sure that the same graphic is drawn in all the locations it needs to be drawn at once to reduce the number of times the current texture needs to be switch. From what I have read, it seems as if Java will take care of this for me and make sure things are drawn in the most optimal fashion, but again, nothing has ever said anything like this clearly.</p>
  
  <p>5) What AWT/Swing classes support hardware acceleration, and which ones should be used? I am currently using a class that extends JFrame to create a window, and adding a Canvas to it from which I create a BufferStrategy. Is this good practice, or is there some other type of way I should be implementing this?</p>
  
  <p>Thank you very much for your time, and I hope I provided clear questions and enough information for you to answer my several questions.</p>