#pragma once
#include "../object.h"
#include <render/texture.h>

namespace render{

class frameBuffer:_object
{
public:
    enum class attach
    {
        color0 = 0x8CE0,
        color1 = 0x8CE1,
        color2 = 0x8CE2,
        color3 = 0x8CE3,
        color4 = 0x8CE4,
        color5 = 0x8CE5,
        color6 = 0x8CE6,
        color7 = 0x8CE7,
        color8 = 0x8CE8,
        color9 = 0x8CE9,
        color10 = 0x8CEA,
        color11 = 0x8CEB,
        color12 = 0x8CEC,
        color13 = 0x8CED,
        color14 = 0x8CEE,
        color15 = 0x8CEF,
        depth = 0x8D00,
        stancil = 0x8D20
    };

    enum class target
    {
        read = 0x8CA8,
        draw = 0x8CA9,
        read_draw = 0x8D40
    };

    frameBuffer();
    ~frameBuffer();

    void gen();
    void free();

    void bind(target = target::draw);
    void unbind();

    void attachTexture(attach, texture&);

private:
    unsigned _obj;
    target _t;
    void _alloc();
};

}
