From 3f4ce758e77b6143d0b2f16d3adb65ab503d000e Mon Sep 17 00:00:00 2001 From: shadowislord Date: Sat, 31 Jan 2015 12:50:56 -0500 Subject: [PATCH] * Use INT_BGR format in AwtPanel - allows using old compatible readFrameBuffer --- .../src/main/java/com/jme3/system/awt/AwtPanel.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/jme3-desktop/src/main/java/com/jme3/system/awt/AwtPanel.java b/jme3-desktop/src/main/java/com/jme3/system/awt/AwtPanel.java index 1bdc1926e..919947d9e 100644 --- a/jme3-desktop/src/main/java/com/jme3/system/awt/AwtPanel.java +++ b/jme3-desktop/src/main/java/com/jme3/system/awt/AwtPanel.java @@ -155,7 +155,7 @@ public class AwtPanel extends Canvas implements SceneProcessor { public void repaintInThread(){ // Convert screenshot. byteBuf.clear(); - rm.getRenderer().readFrameBufferWithFormat(fb, byteBuf,Format.BGRA8); + rm.getRenderer().readFrameBuffer(fb, byteBuf); synchronized (lock){ // All operations on img must be synchronized @@ -168,7 +168,7 @@ public class AwtPanel extends Canvas implements SceneProcessor { public void drawFrameInThread(){ // Convert screenshot. byteBuf.clear(); - rm.getRenderer().readFrameBufferWithFormat(fb, byteBuf,Format.BGRA8); + rm.getRenderer().readFrameBuffer(fb, byteBuf); Screenshots.convertScreenShot2(intBuf, img); synchronized (lock){ @@ -238,6 +238,11 @@ public class AwtPanel extends Canvas implements SceneProcessor { byteBuf = BufferUtils.ensureLargeEnough(byteBuf, width * height * 4); intBuf = byteBuf.asIntBuffer(); + if (fb != null) { + fb.dispose(); + fb = null; + } + fb = new FrameBuffer(width, height, 1); fb.setDepthBuffer(Format.Depth); fb.setColorBuffer(Format.RGB8); @@ -247,7 +252,7 @@ public class AwtPanel extends Canvas implements SceneProcessor { } synchronized (lock){ - img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + img = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR); } // synchronized (lock){