http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=share;action=display;num=1036791657
If bufferstragey.contentsLost return true, then only way I could resolve it was to recreate a new bufferstrategy instances. See full example posted at the end of given url.
Is this safe to do in case of contentsLost event?
private void render() {
// buffer lost, recreate
if( bufferStrategy.contentsLost() ) {
// if I comment createBuff.. and getBuffer methods
// then it never recover the contentsLost state.
mainFrame.createBufferStrategy( 2 ); // or use 3
bufferStrategy = mainFrame.getBufferStrategy();
return;
}
Graphics g = bufferStrategy.getDrawGraphics();
...continue normal renderer
}