aboutsummaryrefslogtreecommitdiff
#ifndef FBO_H
#define FBO_H

#include "../shared.h"

struct _Texture;

typedef struct _Fbo
{
    char _name[MAX_PATH_LENGTH];

    GLuint frame_buffer; /** Actual fbo object**/

    /** color_texture when you want to render to a
        texture and color_buffer when you want to render
        to a RenderBuffer **/
    struct _Texture *color_textures[8];
    GLuint color_buffer[8];
    GLenum color_format;

    struct _Texture *depth_texture;
    GLuint depth_buffer;
    GLenum depth_format;

    GLint width;
    GLint height;
} Fbo;

extern Fbo *fbo_new(const char *name, GLint width, GLint height);
extern void fbo_attach_buffer(Fbo *fbo, GLenum format, int index);
extern void fbo_attach_texture(Fbo *fbo, struct _Texture *t, GLenum attachment);
extern void fbo_bind(Fbo *fbo);
extern void fbo_purge(Fbo *fbo);

#endif // FBO_H