Hi,

I'm using build 1.6.0_10-beta-b22 and I'm having some performance problems with 
the d3d pipeline enabled. In an application I'm writing, I copy a JComponent to 
a BufferedImage in order to perform some animations and apply other graphical 
effects to. I noticed that my all my animations would take a long time to 
begin. After some digging, I found that the JDK with d3d disabled 
([b]-Dsun.java2d.d3d=false[/b]) was [u]16x[/u] faster than with d3d enabled?! 
I'm using an NVidia 8600 card with 256MB of VRAM on Vista enterprise sp1 64bit. 

Here's the code that's causing problems with d3d enabled:

[code]
public static BufferedImage getImageOfComponent(JComponent comp, boolean 
opaque) {
  BufferedImage newImg = createCompatibleImage(comp.getWidth(), 
comp.getHeight(), opaque);

  Graphics2D g2 = g2.createGraphics();
  comp.paint(g2);
  g2.dispose();

  return newImg;
}

public static BufferedImage createCompatibleImage(int width, int height, 
boolean opaque) {
  GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
  GraphicsDevice d = e.getDefaultScreenDevice();
  GraphicsConfiguration c = d.getDefaultConfiguration();
  BufferedImage compatibleImage = c.createCompatibleImage(width,
                                                          height,
                                                          opaque
                                                              ? 
Transparency.OPAQUE
                                                              : 
Transparency.TRANSLUCENT);
  return compatibleImage;
}
[/code]

This 15-16x slowdown (with d3d enabled) occurs whether I create a Transparent, 
Opaque, or Bitmask BufferedImage. 

With d3d enabled, what takes about 56ms to render, and copy to a bufferedimage 
takes about 900ms!
[Message sent by forum member 'nazmulidris' (nazmulidris)]

http://forums.java.net/jive/thread.jspa?messageID=272468

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to