#include <vector>
#include "bindable.h"
#include "gl.h"
+#include "texturecube.h"
namespace Msp {
namespace GL {
buffers. Renderbuffers and Textures can be attached to the logical buffers. At
least one image must be attached for the framebuffer to be usable.
-Requires the GL_EXT_framebuffer_object extension.
+Requires the GL_EXT_framebuffer_object extension. The blit functions require
+the GL_EXT_framebuffer_blit extension.
*/
class Framebuffer: public Bindable<Framebuffer>
{
Texture *tex;
};
unsigned level;
+ GLenum cube_face;
Attachment(FramebufferAttachment);
void set(Renderbuffer &);
- void set(Texture &, unsigned);
+ void set(Texture &, GLenum, unsigned);
void clear();
};
private:
void update_attachment(unsigned) const;
void check_size();
+ unsigned get_attachment_index(FramebufferAttachment);
public:
void attach(FramebufferAttachment attch, Renderbuffer &rbuf);
void attach(FramebufferAttachment attch, Texture2D &tex, unsigned level = 0);
+ void attach(FramebufferAttachment attch, TextureCube &tex, TextureCubeFace face, unsigned level = 0);
void detach(FramebufferAttachment attch);
- /**
- Checks the completeness status of the framebuffer. Returns
- FRAMEBUFFER_COMPLETE if the framebuffer is complate and can be rendered to,
- or one of the error status codes otherwise.
- */
+ /** Checks the completeness of the framebuffer. Returns
+ FRAMEBUFFER_COMPLETE if the framebuffer is complete and can be rendered to,
+ or one of the error status codes otherwise. */
FramebufferStatus check_status() const;
void clear(BufferBits);
- void blit_from(const Framebuffer &, int, int, int, int, int, int, int, int, BufferBits, bool);
- void blit_from(const Framebuffer &, int, int, unsigned, unsigned, int, int, BufferBits);
- void blit_from(const Framebuffer &, BufferBits, bool);
+
+ /** Blits a region from another framebuffer into this one. If the source
+ and destination regions have different dimensions, the contents will be
+ stretched. If filter is true, linear interpolation will be used, otherwise
+ no interpolation is done. */
+ void blit_from(const Framebuffer &other, int sx0, int sy0, int sx1, int sy1,
+ int dx0, int dy0, int dx1, int dy1, BufferBits bits, bool filter);
+
+ /** Blits a region from another framebuffer into this one, retaining its
+ dimensions. */
+ void blit_from(const Framebuffer & other, int sx, int sy,
+ unsigned wd, unsigned ht, int dx, int dy, BufferBits bits);
+
+ /** Blits the entire contents of another framebuffer into this one. */
+ void blit_from(const Framebuffer &other, BufferBits bits, bool filter);
void bind() const;
static void unbind();
static Framebuffer &system();
-private:
- unsigned get_attachment_index(FramebufferAttachment);
};
inline BufferBits operator|(BufferBits a, BufferBits b)