Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java : VolatileImage slower than BufferedImage

I'm making a game in java and in used BufferedImages to render content to the screen. I had performance issues on low end machines where the game is supposed to run, so I switched to VolatileImage which are normally faster. Except they actually slow the whole thing down.

The images are created with GraphicsConfiguration.createCompatibleVolatileImage(...) and are drawn to the screen with Graphics.drawImage(...) (follow link to see which one specifically). They are drawn upon a Canvas using double buffering.

Does someone has an idea of what is going wrong here ?

like image 403
Norswap Avatar asked Apr 21 '10 15:04

Norswap


1 Answers

Most likely your code is mixing accelerated and unaccelerated operations.

This document is a must read. Section 3.2 in particular is essential for anyone working with accelerated Java graphics.

like image 61
Devon_C_Miller Avatar answered Sep 24 '22 21:09

Devon_C_Miller