• Post Reply Bookmark Topic Watch Topic
  • New Topic

BufferedImage versus VolatileImage  RSS feed

 
Andy Selador
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The topic pretty much says it. In what cases is one image type preferable to the other, assuming the image is used for buffering - a long computation that results in an update to the image, which is then drawn on a JPanel. Also, just list any other advantages and disadvantages. I know volatile images may have to be restored at any time, but with that disadvantage, whats the advantage?

Thanks,

Andy
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Disclaimer: I'm no expert on this stuff.

That said, the only advantage of VolatileImage that I'm aware of is that is is hardware accelerated, hence can provide some increase of speed for high fps games etc. On modern fast machines with adequate RAM, I don't think this makes a perceptible difference.

If a long computation is involved, I would say the better choice is BufferedImage.

Would be nice to know the views of anyone who has used VolatilImage to advantage.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a good in-depth discussion on VolatileImage on Chet Haase's Blog - VolatileImage Q&A
 
Andy Selador
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, thats exactly what I'm looking for. Volatile images seem kind of a hassle... at any moment the VRAM may be reclaimed, meaning if you had a separate thread perform the rendering, you have to instantiate and run it again (though I guess you could have a buffered image snapshot , but I'm don't know about performance issues and trade offs - is it better to redo the rendering on the volatile image and have that drawn to the screen, or to have a buffered image snapshot made during initial rendering, and have that drawn to the screen if the volatile image needs to be rerendered...).

Andy
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Nate, that's a good link.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!