From 2e58f2774cb11b69cc952f781abea082482d55d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Wei=C3=9F?= Date: Wed, 28 Sep 2016 08:19:04 +0200 Subject: [PATCH] #503 fixed --- .../src/main/java/com/jme3/texture/FrameBuffer.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java b/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java index e5755c595..4c7a813ee 100644 --- a/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java +++ b/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java @@ -510,14 +510,17 @@ public class FrameBuffer extends NativeObject { } /** - * @return The first color buffer attached to this FrameBuffer, or null + * @return The color buffer with the index set by {@link #setTargetIndex(int), or null * if no color buffers are attached. + * If MRT is disabled, the first color buffer is returned. */ public RenderBuffer getColorBuffer() { if (colorBufs.isEmpty()) return null; - - return colorBufs.get(0); + if (colorBufIndex<0 || colorBufIndex>=colorBufs.size()) { + return colorBufs.get(0); + } + return colorBufs.get(colorBufIndex); } /**