#ifndef GLFBO_H
#define GLFBO_H

#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <vector>
#include <functional>
#include "GLTexture/GLTexture.h"

class GLFBO {
public:
    GLFBO();
    ~GLFBO();
    void checkStatus();
    void bind();
    void setShape(int w, int h);
    std::vector<std::shared_ptr<GLTexture>> color;

private:
    std::shared_ptr<GLTexture> initTexture(int width, int height, int attachment);
    GLuint handle;
    int width;
    int height;

    class FBOState {
    public:
        FBOState();
        void restore();
    private:
        int fbo;
        int rbo;
        int tex;
    };
};

#endif