#include "bindable.h"
#include "gl.h"
#include "texturecube.h"
+#include <msp/gl/extensions/arb_geometry_shader4.h>
+#include <msp/gl/extensions/ext_framebuffer_multisample.h>
#include <msp/gl/extensions/ext_framebuffer_object.h>
+#include <msp/gl/extensions/nv_fbo_color_attachments.h>
namespace Msp {
namespace GL {
class Renderbuffer;
class Texture;
class Texture2D;
+class Texture3D;
enum FramebufferAttachment
{
FRAMEBUFFER_INCOMPLETE_FORMATS = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT,
FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER,
FRAMEBUFFER_INCOMPLETE_READ_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER,
+ FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE,
+ FRAMEBUFFER_INCOMPLETE_LAYER_COUNT = GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB,
+ FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS,
FRAMEBUFFER_UNSUPPORTED = GL_FRAMEBUFFER_UNSUPPORTED,
FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE
};
{
COLOR_BUFFER_BIT = GL_COLOR_BUFFER_BIT,
DEPTH_BUFFER_BIT = GL_DEPTH_BUFFER_BIT,
- STENCIL_BUFFER_BIT = GL_STENCIL_BUFFER_BIT,
- ACCUM_BUFFER_BIT = GL_ACCUM_BUFFER_BIT
-};
-
-enum RWBuffer
-{
- NO_BUFFER = GL_NONE,
- FRONT_LEFT = GL_FRONT_LEFT,
- FRONT_RIGHT = GL_FRONT_RIGHT,
- BACK_LEFT = GL_BACK_LEFT,
- BACK_RIGHT = GL_BACK_RIGHT,
- FRONT = GL_FRONT,
- BACK = GL_BACK,
- LEFT = GL_LEFT,
- RIGHT = GL_RIGHT,
- FRONT_AND_BACK = GL_FRONT_AND_BACK
+ STENCIL_BUFFER_BIT = GL_STENCIL_BUFFER_BIT
};
class framebuffer_incomplete: public std::runtime_error
Texture *tex;
};
unsigned level;
- GLenum cube_face;
+ unsigned layer;
Attachment(FramebufferAttachment);
void set(Renderbuffer &);
- void set(Texture &, GLenum, unsigned);
+ void set(Texture &, unsigned, unsigned);
void clear();
};
+ struct Viewport
+ {
+ int left;
+ int bottom;
+ unsigned width;
+ unsigned height;
+
+ Viewport();
+ };
+
unsigned id;
std::vector<Attachment> attachments;
unsigned width;
unsigned height;
+ Viewport view;
mutable unsigned dirty;
Framebuffer(unsigned);
public:
void attach(FramebufferAttachment attch, Renderbuffer &rbuf);
void attach(FramebufferAttachment attch, Texture2D &tex, unsigned level = 0);
+ void attach(FramebufferAttachment attch, Texture3D &tex, unsigned layer, unsigned level = 0);
void attach(FramebufferAttachment attch, TextureCube &tex, TextureCubeFace face, unsigned level = 0);
void detach(FramebufferAttachment attch);
isn't. */
void require_complete() const;
+ void viewport(int, int, unsigned, unsigned);
+ void reset_viewport();
+
void clear(BufferBits);
/** Blits a region from another framebuffer into this one. If the source