Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Double Buffering with applet
#1
Hey so i am trying to get my game to work and I have to double buffer to reduce screen flickering

I have a vague idea of how this works. I know you have to get the Graphics object of an image and override the update() method of applet, but other than that i do not understand.

mainly if i have multiple images that do not need to change how do i not update them all, without clearing them from the screen?
Reply
#2
I'm not sure how this works exactly in Java, but I'll tell you the general method of double-buffering.

You create a texture the same size as the thing you want to buffer (in this case your screen) and then instead of drawing your objects directly to your screen, you draw them to your texture and then when you have finished you draw the whole texture to the screen in one go. Since drawing the whole texture is a single call, it should remove the flickering.

Generally in a game you will clear and re-draw the whole screen every update, it leads to less problems in the long run (such as alpha and Z-sort issues).
[Image: sig.php]
The little boat gently drifted across the pond exactly the way a bowling ball wouldn't.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Double Brace Initialization Project Evolution 0 661 10-10-2009, 01:41 PM
Last Post: Project Evolution

Forum Jump:


Users browsing this thread: 1 Guest(s)