From b7c76799e2c5c6f682dc406e2353958ae8ee3184 Mon Sep 17 00:00:00 2001 From: "Sha..rd" Date: Sun, 11 Nov 2012 07:42:31 +0000 Subject: [PATCH] =?UTF-8?q?=20*=20Attempt=20to=20fix=20SDK=20/=20AWT=20pan?= =?UTF-8?q?els=20issue=20"Framebuffer=20doesn=E2=80=99t=20have=20any=20ren?= =?UTF-8?q?derbuffers=20attached."?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9991 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../jme3/system/lwjgl/LwjglOffscreenBuffer.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/engine/src/lwjgl/com/jme3/system/lwjgl/LwjglOffscreenBuffer.java b/engine/src/lwjgl/com/jme3/system/lwjgl/LwjglOffscreenBuffer.java index b9d7b394f..f404496e4 100644 --- a/engine/src/lwjgl/com/jme3/system/lwjgl/LwjglOffscreenBuffer.java +++ b/engine/src/lwjgl/com/jme3/system/lwjgl/LwjglOffscreenBuffer.java @@ -104,15 +104,20 @@ public class LwjglOffscreenBuffer extends LwjglContext implements Runnable { } protected void runLoop(){ - if (!created.get()) + if (!created.get()) { throw new IllegalStateException(); + } - if (pbuffer.isBufferLost()){ + if (pbuffer.isBufferLost()) { pbuffer.destroy(); - try{ + + try { pbuffer = new Pbuffer(width, height, pixelFormat, null); pbuffer.makeCurrent(); - }catch (LWJGLException ex){ + + // Context MUST be reset here to avoid invalid objects! + renderer.invalidateState(); + } catch (LWJGLException ex) { listener.handleError("Failed to restore pbuffer content", ex); } } @@ -123,7 +128,7 @@ public class LwjglOffscreenBuffer extends LwjglContext implements Runnable { renderer.onFrame(); int frameRate = settings.getFrameRate(); - if (frameRate >= 1){ + if (frameRate >= 1) { Display.sync(frameRate); } }