PostProcessor working: nested FBO won't work, use FrameBufferManager

This commit is contained in:
minjaesong
2018-07-03 13:48:34 +09:00
parent 108a3e6188
commit 6b929ac107
154 changed files with 929 additions and 67 deletions

View File

@@ -0,0 +1,30 @@
package net.torvald.terrarum;
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
import java.util.Stack;
/**
* Nested FBOs are just not a thing in GL!
*
* Created by minjaesong on 2018-07-03.
*
* @link https://stackoverflow.com/questions/25471727/libgdx-nested-framebuffer
*/
public class FrameBufferManager {
private static Stack<FrameBuffer> stack = new Stack<FrameBuffer>();
public static void begin(FrameBuffer buffer) {
if (!stack.isEmpty()) {
stack.peek().end();
}
stack.push(buffer).begin();
}
public static void end() {
stack.pop().end();
if (!stack.isEmpty()) {
stack.peek().begin();
}
}
}