소스 검색

Merge pull request #561 from shamanDevel/FixFor#503

#503 fixed
empirephoenix 8 년 전
부모
커밋
7958ae2f46
1개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 6 3
      jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java

+ 6 - 3
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);
     }
 
     /**