• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have exactly the same question.
 
Saloon Keeper
Posts: 15524
364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
You can't have everything. Where would you put it?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic