Hi, :chimpanzee_amused:
I have found a bug that happens with MRT Framebuffers with same number of color attachments.
If we set a frame buffer frame1, then later frame2.
r.setFrameBuffer(frame1);
r.setFrameBuffer(frame2);
Frame2 buffer will not output to multiple targets. Only its first target will be rendered.
The culprit I believe is in the GLRenderer.setReadDrawBuffers method
if (context.boundDrawBuf != MRT_OFF + fb.getNumColorBuffers()) {
intBuf16.clear();
for (int i = 0; i < fb.getNumColorBuffers(); i++) {
intBuf16.put(GLFbo.GL_COLOR_ATTACHMENT0_EXT + i);
}
intBuf16.flip();
glext.glDrawBuffers(intBuf16);
context.boundDrawBuf = MRT_OFF + fb.getNumColorBuffers();
}
Eg. the problem does not happen if one MRT frame buffer has 2 attachements and another one 3.
Thus deleteing the if statement fixes the problem.
I have put a patch on git here: Fix for MTR Framebuffers by TehLeo · Pull Request #554 · jMonkeyEngine/jmonkeyengine · GitHub