mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-10 13:51:53 +09:00
PostProcessor working: nested FBO won't work, use FrameBufferManager
This commit is contained in:
30
src/net/torvald/terrarum/FrameBufferManager.java
Normal file
30
src/net/torvald/terrarum/FrameBufferManager.java
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user