polyadvent

A game engine from scratch in C
git clone git://jb55.com/polyadvent
Log | Files | Refs | README

fbo.h (846B)


      1 #ifndef POLYADVENT_FBO_H
      2 #define POLYADVENT_FBO_H
      3 
      4 #include "common.h"
      5 #include "gl.h"
      6 
      7 #define MAX_FBO_ATTACHMENTS 3
      8 
      9 struct fbo {
     10     GLuint handle;
     11     GLuint attachments[MAX_FBO_ATTACHMENTS];
     12     int n_attachments;
     13     int width, height;
     14 };
     15 
     16 void init_fbo(struct fbo *fbo);
     17 void bind_fbo(struct fbo *fbo);
     18 void create_fbo(struct fbo *fbo, int width, int height);
     19 
     20 int fbo_attach_color_texture(struct fbo *fbo);
     21 int fbo_attach_depth_texture(struct fbo *fbo);
     22 
     23 int fbo_attach_texture(struct fbo *fbo, GLint internalformat, GLint format,
     24                        GLenum attachment, GLenum type);
     25 
     26 int fbo_attach_renderbuffer(struct fbo *fbo, GLenum internalformat,
     27                             GLenum attachment);
     28 
     29 
     30 
     31 void check_fbo(struct fbo *fbo);
     32 void delete_fbo(struct fbo *);
     33 void unbind_fbo(struct fbo *fbo);
     34 
     35 
     36 
     37 #endif /* POLYADVENT_FBO_H */