Hi there.
I want to load images and have them hw accelerated. I’ve read many tutorials, the JavaDoc and the forum topics here and think I have done everything correct, but my images are never gets accelerated.
Am I missing something? Below is my code for image loading if anyone could give me a hint:
This one is my the real image loading (my codec files):
return ImageIO.read(location);
This one manages the resource for my engine:
this.image = (BufferedImage) this.codec.decode(this.location);
ImageCapabilities ic = this.image.getCapabilities(this.image
.createGraphics().getDeviceConfiguration());
Core.getLogger().info("Image locat: " + this.location);
Core.getLogger().info("Image accel: " + ic.isAccelerated());
Core.getLogger().info("Image volat: " + ic.isTrueVolatile());
GraphicsConfiguration gc = GraphicsEnvironment
.getLocalGraphicsEnvironment().getDefaultScreenDevice()
.getDefaultConfiguration();
BufferedImage accelImage = gc.createCompatibleImage(this.image
.getWidth(), this.image.getHeight(), this.image
.getTransparency());
Graphics2D g2 = accelImage.createGraphics();
g2.setComposite(AlphaComposite.Src);
g2.drawImage(this.image, 0, 0, null);
g2.dispose();
ic = accelImage.getCapabilities(accelImage.createGraphics()
.getDeviceConfiguration());
Core.getLogger().info("AccelImage locat: " + this.location);
Core.getLogger().info("AccelImage accel: " + ic.isAccelerated());
Core.getLogger().info("AccelImage volat: " + ic.isTrueVolatile());
But any of the debug outputs give no acceleration and no volatile on output.