diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderAWT.java b/engine/src/blender/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderAWT.java index b1ea2bb4b..2a99124c9 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderAWT.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderAWT.java @@ -79,7 +79,7 @@ public class TextureBlenderAWT extends AbstractTextureBlender { for (int dataLayerIndex = 0; dataLayerIndex < depth; ++dataLayerIndex) { ByteBuffer data = image.getData(dataLayerIndex); data.rewind(); - ByteBuffer newData = BufferUtils.createByteBuffer(width * height * 4); + ByteBuffer newData = BufferUtils.createByteBuffer(data.limit()); int dataIndex = 0, x = 0, y = 0, index = 0; while (index < data.limit()) { diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderLuminance.java b/engine/src/blender/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderLuminance.java index 2e255d292..e5acb1bd6 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderLuminance.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderLuminance.java @@ -50,7 +50,7 @@ public class TextureBlenderLuminance extends AbstractTextureBlender { for (int dataLayerIndex = 0; dataLayerIndex < depth; ++dataLayerIndex) { ByteBuffer data = image.getData(dataLayerIndex); data.rewind(); - ByteBuffer newData = BufferUtils.createByteBuffer(width * height * 4); + ByteBuffer newData = BufferUtils.createByteBuffer(data.limit()); int dataIndex = 0, x = 0, y = 0; while (data.hasRemaining()) {