Yep, latest drivers for all my components.
DirectX acceleration is at full and all my games work perfectly, both GL and DX.
Yep, latest drivers for all my components.
DirectX acceleration is at full and all my games work perfectly, both GL and DX.
I’ll just, totally unhelpfully, add at this stage this is why we developed LWJGL
Cas
The testcase didn’t compile right away.
After some fixing it compiled and yea it wasn’t accelerated at all.
After adding thag GraphicsConfiguration stuff (I mentioned that before) it was accelerated after the image was drawn once.
import java.awt.image.*;
import java.awt.*;
[...]
static BufferedImage img = null;
private GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
[...]
public Main( int w, int h )
{
render = new Renderer(w, h);
try
{
Image timg = ImageIO.read(new File("4.png"));
img=gc.createCompatibleImage(timg.getWidth(null),timg.getHeight(null),Transparency.OPAQUE);
Graphics2D g2d=(Graphics2D)img.getGraphics();
g2d.setComposite(AlphaComposite.Src);
g2d.drawImage(timg,0,0,null);
g2d.dispose();
}
catch ( IOException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
[...]
//added to that "execute" method
acc = img.getCapabilities(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration()).isAccelerated();
[...]
THANK YOU oNyx.
Thanks, it works now.
I’m going to analyse your code so I can understand what you’ve done compared to what I’ve done and didn’t do.
I love you oNyx
Aww, isn’t appreciation grand.
Kev
Question, why doesn’t Sun auto enable hardware acceleration for transparent images?
Why do I need to enable it via commandline when Sun can force it automatically?
Why do I need to enable it via commandline when Sun can
force it automatically?
Because it doesn’t work with all configurations (crappy drivers are to blame). So Sun picked the correct choice… working > fast.