What platform and Java version is this with? Thanks, Dmitri
[EMAIL PROTECTED] wrote:
I am using BufferStrategy with 2 buffers to render off screen and then blast the contents on to the screen and I am impressed with the simplicity of it and its performance. However, there is a VERY serious problem with it, at least the way I am using it. It seems that whenever the JFrame is resized something is causing the screen to be cleared. The result is bad flickering or, even worse, a totally blank screen. I am using BufferStrategy in the technique in the JavaDoc as follows: [code] do { do { g2d = (Graphics2D)this.strategy.getDrawGraphics(); // Perform rendering here... g2d.dispose(); } while (this.strategy.contentsRestored()); strategy.show(); } while (strategy.contentsLost()); [/code] The clearing of the screen happens after any calls to strategy.show() and even if I call it repeatedly after a resize event it seems that the screen will clear after the last call. All that is required to restore the screen's contents is to render again but I cannot work out how to trap this screen clearing event and therefore know when to re-render. Why is the screen clearing after the frame is resized? Is there a way to prevent this, perhaps by using a different actual strategy for the BufferStrategy? The screen clearing after resizing doesn't occur if I just manually use a BufferedImage instead.
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".