package com.projectseptember.RNGL; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executor; import static android.opengl.GLES20.*; public class GLFBO { public final List color = new ArrayList<>(); private int handle; private int width = 0; private int height = 0; private Executor glExecutor; /** * GLFBO constructor as well as all methods must be called in GL Thread * @param glExecutor is only required for finalize() */ public GLFBO (Executor glExecutor) { this.glExecutor = glExecutor; FBOState state = new FBOState(); int[] handleArr = new int[1]; glGenFramebuffers(1, handleArr, 0); handle = handleArr[0]; int numColors = 1; glBindFramebuffer(GL_FRAMEBUFFER, handle); for(int i=0; i maxFBOSize[0] || h < 0 || h > maxFBOSize[0]) { throw new IllegalArgumentException("Can't resize framebuffer. Invalid dimensions"); } width = w; height = h; FBOState state = new FBOState(); for (GLTexture clr: color) { clr.setShape(w, h); } glBindFramebuffer(GL_FRAMEBUFFER, handle); checkStatus(); state.restore(); } }