sgltk 0.6
Simple OpenGL Tool Kit
Loading...
Searching...
No Matches
framebuffer.h
1#ifndef __FRAMEBUFFER_H__
2#define __FRAMEBUFFER_H__
3
4#include "app.h"
5#include "texture.h"
6#include "renderbuffer.h"
7
8namespace sgltk {
9
15 GLuint buffer;
16 GLenum target;
17 unsigned int width;
18 unsigned int height;
19 std::vector<GLenum> draw_buffers;
20
21 static int max_color_attachments;
22public:
26 EXPORT Framebuffer(GLenum target = GL_FRAMEBUFFER);
27 EXPORT ~Framebuffer();
32 EXPORT GLenum get_buffer_status();
36 EXPORT void bind();
41 EXPORT void bind(GLenum target);
45 EXPORT void unbind();
52 EXPORT bool attach_texture(GLenum attachment,
53 Texture& texture);
62 EXPORT bool attach_texture_layer(GLenum attachment,
63 Texture& texture,
64 unsigned int layer);
72 EXPORT bool attach_renderbuffer(GLenum attachment,
73 Renderbuffer& buffer);
77 EXPORT void finalize();
92 EXPORT void blit_to(sgltk::Framebuffer *target,
93 unsigned int src_x0,
94 unsigned int src_y0,
95 unsigned int src_x1,
96 unsigned int src_y1,
97 unsigned int dst_x0,
98 unsigned int dst_y0,
99 unsigned int dst_x1,
100 unsigned int dst_y1,
101 GLbitfield mask,
102 GLenum filter);
115 EXPORT void blit_from_default(unsigned int src_x0,
116 unsigned int src_y0,
117 unsigned int src_x1,
118 unsigned int src_y1,
119 unsigned int dst_x0,
120 unsigned int dst_y0,
121 unsigned int dst_x1,
122 unsigned int dst_y1,
123 GLbitfield mask,
124 GLenum filter);
125};
126
127}
128
129#endif
Manages framebuffers.
Definition framebuffer.h:14
void finalize()
Sets the draw buffers to be drawn into.
bool attach_texture_layer(GLenum attachment, Texture &texture, unsigned int layer)
Attaches the layer of a texture to the framebuffer.
void blit_from_default(unsigned int src_x0, unsigned int src_y0, unsigned int src_x1, unsigned int src_y1, unsigned int dst_x0, unsigned int dst_y0, unsigned int dst_x1, unsigned int dst_y1, GLbitfield mask, GLenum filter)
Copies a block of pixels from the default framebuffer to this one.
void bind()
Binds the framebuffer to the target set in the constructor.
void blit_to(sgltk::Framebuffer *target, unsigned int src_x0, unsigned int src_y0, unsigned int src_x1, unsigned int src_y1, unsigned int dst_x0, unsigned int dst_y0, unsigned int dst_x1, unsigned int dst_y1, GLbitfield mask, GLenum filter)
Copies a block of pixels from this framebuffer to another one.
bool attach_renderbuffer(GLenum attachment, Renderbuffer &buffer)
Attaches a renderbuffer to the framebuffer.
Framebuffer(GLenum target=GL_FRAMEBUFFER)
bool attach_texture(GLenum attachment, Texture &texture)
Attaches a texture to the framebuffer.
GLenum get_buffer_status()
Checks the completeness status of the framebuffer.
void unbind()
Restores the original framebuffer as render target.
Manages renderbuffers.
Manages textures.
Definition texture.h:13