Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think this is what you're looking for on information about double buffering:</p> <p><a href="http://docs.oracle.com/javase/tutorial/extra/fullscreen/doublebuf.html" rel="nofollow">http://docs.oracle.com/javase/tutorial/extra/fullscreen/doublebuf.html</a></p> <p>You could turn off double buffering with setDoubleBuffered(false) if you can't get access to the underlying buffer which I'm not entirely sure you can. </p> <p>I don't think you can safely draw on an image from another thread because you'll get into the thread writing to the image while the EDT is reading that same image as it redraws. If you share an image between them you're going to have multi-threading issues that you'll have to synchronize. If you synchronize then you're performance isn't going to be very good. If you instantiate a new image every frame you're memory is going to skyrocket and GC will get you. You may be able to instantiate 10 frames and keep the writing away from the reading or something like that, but either way this is going to very tricky to make it performant and correct.</p> <p>My suggestion is to do all drawing from EDT, and figure out a way to do the calculations (rendering) on another thread that doesn't involve ImageBuffer sharing.</p> <p><strong>Update</strong> While it is used for fullscreen. The suggestions in there apply to windowed mode as well: "Separate your drawing code from your rendering loop, so that you can operate fully under both full-screen exclusive and windowed modes." See this <a href="http://docs.oracle.com/javase/tutorial/extra/fullscreen/rendering.html" rel="nofollow">http://docs.oracle.com/javase/tutorial/extra/fullscreen/rendering.html</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload