Norswap
Norswap

Reputation: 12222

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 ?

Upvotes: 6

Views: 4880

Answers (1)

Devon_C_Miller
Devon_C_Miller

Reputation: 16518

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.

Upvotes: 6

Related Questions