* Use INT_BGR format in AwtPanel - allows using old compatible readFrameBuffer

experimental
shadowislord 10 years ago
parent 13e9cdc201
commit 3f4ce758e7
  1. 11
      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(){ public void repaintInThread(){
// Convert screenshot. // Convert screenshot.
byteBuf.clear(); byteBuf.clear();
rm.getRenderer().readFrameBufferWithFormat(fb, byteBuf,Format.BGRA8); rm.getRenderer().readFrameBuffer(fb, byteBuf);
synchronized (lock){ synchronized (lock){
// All operations on img must be synchronized // All operations on img must be synchronized
@ -168,7 +168,7 @@ public class AwtPanel extends Canvas implements SceneProcessor {
public void drawFrameInThread(){ public void drawFrameInThread(){
// Convert screenshot. // Convert screenshot.
byteBuf.clear(); byteBuf.clear();
rm.getRenderer().readFrameBufferWithFormat(fb, byteBuf,Format.BGRA8); rm.getRenderer().readFrameBuffer(fb, byteBuf);
Screenshots.convertScreenShot2(intBuf, img); Screenshots.convertScreenShot2(intBuf, img);
synchronized (lock){ synchronized (lock){
@ -238,6 +238,11 @@ public class AwtPanel extends Canvas implements SceneProcessor {
byteBuf = BufferUtils.ensureLargeEnough(byteBuf, width * height * 4); byteBuf = BufferUtils.ensureLargeEnough(byteBuf, width * height * 4);
intBuf = byteBuf.asIntBuffer(); intBuf = byteBuf.asIntBuffer();
if (fb != null) {
fb.dispose();
fb = null;
}
fb = new FrameBuffer(width, height, 1); fb = new FrameBuffer(width, height, 1);
fb.setDepthBuffer(Format.Depth); fb.setDepthBuffer(Format.Depth);
fb.setColorBuffer(Format.RGB8); fb.setColorBuffer(Format.RGB8);
@ -247,7 +252,7 @@ public class AwtPanel extends Canvas implements SceneProcessor {
} }
synchronized (lock){ synchronized (lock){
img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); img = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR);
} }
// synchronized (lock){ // synchronized (lock){

Loading…
Cancel
Save