This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Game Development and the fly likes Does every image need to be a 'VolatileImage' in a 2d game? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "Does every image need to be a Watch "Does every image need to be a New topic
Author

Does every image need to be a 'VolatileImage' in a 2d game?

C Wang
Greenhorn

Joined: Jun 05, 2009
Posts: 3
I'm a little confused about how VolatileImage s are supposed to be used.
Are they just for the 'main' image (the one you draw other images on) or should the other images (like sprite images) be VolatileImage as well?

for example i have 2 images 'screenimage' and 'enemyimage', and I draw enemyimage on to screenimage
if I want to use hardware acceleration on them should I just make screenimage a VolatileImage or should enemyimage be a VolatileImage too?
Marlon Drescher
Greenhorn

Joined: Jun 20, 2011
Posts: 1
I have exactly the same question.


http://www.forgottenelements.com
Free JAVA Action MMORPG!
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3615
    
  14

Hi Marlon, welcome to CodeRanch.

You only need VolatileImage if you want hardware acceleration for your image. This is usually the case for offscreen rendering of a scene. Swing already takes care of most of this.

Just use BufferedImage, and only if performance is low, should you consider using a VolatileImage for rendering scenes. Static graphics objects should never use VolatileImage.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Does every image need to be a 'VolatileImage' in a 2d game?