mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-08 04:41:51 +09:00
31 lines
705 B
Java
31 lines
705 B
Java
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();
|
|
}
|
|
}
|
|
}
|