1#include "frame_buffer.h"
14 ctx.frame_buffer_blit(
this, src_rect, 0, dst_rect, btbs, interpolate);
19 ctx.frame_buffer_blit(
this, src_rect, &dst_fbo, dst_rect, btbs, interpolate);
24 ctx.frame_buffer_blit(0, src_rect,
this, dst_rect, btbs, interpolate);
29 ctx.frame_buffer_blit(&src_fbo, src_rect,
this, dst_rect, btbs, interpolate);
39 std::cerr <<
"could not destruct frame buffer properly." << std::endl;
47 ctx.frame_buffer_destruct(*
this);
61 return ctx.frame_buffer_create(*
this);
91 last_error =
"can only attach 2d textures to a frame buffer";
95 return ctx.frame_buffer_attach(*
this, tex2d,
102 if (tex3d.tt != TT_CUBEMAP) {
103 last_error =
"can only attach slices of 3d textures or cube maps to a frame buffer";
108 return ctx.frame_buffer_attach(*
this, tex3d,
115 return ctx.frame_buffer_is_complete(*
this);
122 ,
int i4 ,
int i5 ,
int i6 ,
int i7
123 ,
int i8 ,
int i9 ,
int i10,
int i11
124 ,
int i12,
int i13,
int i14,
int i15)
126 enabled_color_attachments.clear();
128 enabled_color_attachments.push_back(i0);
130 enabled_color_attachments.push_back(i1);
132 enabled_color_attachments.push_back(i2);
134 enabled_color_attachments.push_back(i3);
136 enabled_color_attachments.push_back(i4);
138 enabled_color_attachments.push_back(i5);
140 enabled_color_attachments.push_back(i6);
142 enabled_color_attachments.push_back(i7);
144 enabled_color_attachments.push_back(i8);
146 enabled_color_attachments.push_back(i9);
148 enabled_color_attachments.push_back(i10);
150 enabled_color_attachments.push_back(i11);
152 enabled_color_attachments.push_back(i12);
154 enabled_color_attachments.push_back(i13);
156 enabled_color_attachments.push_back(i14);
158 enabled_color_attachments.push_back(i15);
159 return ctx.frame_buffer_enable(*
this);
164 enabled_color_attachments = indices;
165 return ctx.frame_buffer_enable(*
this);
185 return ctx.frame_buffer_disable(*
this);
190 return ctx.frame_buffer_get_max_nr_color_attachments();
195 return ctx.frame_buffer_get_max_nr_draw_buffers();
base class for all drawables, which is independent of the used rendering API.
void push_window_transformation_array()
push a copy of the current viewport and depth range arrays defining the window transformations
virtual void set_depth_range(const dvec2 &depth_range=dvec2(0, 1), int array_index=-1)
set the current depth range or one of the depth ranges in the window transformation array
virtual void pop_window_transformation_array()
restore previous viewport and depth range arrays defining the window transformations
virtual void set_viewport(const ivec4 &viewport, int array_index=-1)
set the current viewport or one of the viewports in the window transformation array
this class encapsulate frame buffers that live on the GPU and can be used as destination for the rend...
bool create(const context &ctx, int _width=-1, int _height=-1)
create framebuffer if extension is supported, otherwise return false.
void push_viewport(context &ctx, const dvec2 &depth_range=dvec2(0, 1))
push a new window transformation to cover the fbo onto the window transformation stack
bool is_complete(const context &ctx) const
check for completeness, if not complete, get the reason in last_error
static int get_max_nr_color_attachments(const context &ctx)
return the maximum number of color attachments supported by the GPU
int get_width() const
return the width
void set_size(int _width, int _height)
set different size
void pop_viewport(context &ctx)
recover the window transformation array active before the last call to push_viewport
~frame_buffer()
destructor
void destruct(const context &ctx)
destruct the framebuffer objext
bool attach(const context &ctx, const render_buffer &rb, int i=0)
attach render buffer to depth buffer if it is a depth buffer, to stencil if it is a stencil buffer or...
bool enable(context &ctx, int i0=-1, int i1=-1, int i2=-1, int i3=-1, int i4=-1, int i5=-1, int i6=-1, int i7=-1, int i8=-1, int i9=-1, int i10=-1, int i11=-1, int i12=-1, int i13=-1, int i14=-1, int i15=-1)
enable the framebuffer either with all color attachments if no arguments are given or if arguments ar...
bool disable(context &ctx)
disable the framebuffer object
static int get_max_nr_draw_buffers(const context &ctx)
return the maximum number of simultaneous draw buffers supported by the GPU
frame_buffer()
constructor just initializes stuff
void set_height(int _height)
set a different height
void blit_to(context &ctx, BufferTypeBits btbs=BTB_ALL_BITS, bool interpolate=false) const
different variants of blitting rectangle src_rect of this frame buffer into rectangle dest_rect of de...
std::string last_error
a string that contains the last error, which is only set by the init method
void set_width(int _width)
set a different width
int get_height() const
return the height
void blit_from(context &ctx, BufferTypeBits btbs=BTB_ALL_BITS, bool interpolate=false)
different variants of blitting to rectangle dst_rect of this frame buffer from rectangle src_rect of ...
this class encapsulate render buffers that live on the GPU which must support frame buffer objects fo...
bool is_depth_buffer() const
return whether the component format corresponds to a depth buffer format
const context * ctx_ptr
keep pointer to my context
the texture class encapsulates all functionality independent of the rendering api.
void ensure_state(const context &ctx) const
ensure the the texture state is synchronized with the GPU settings
@ CF_D
color format with components B, G, R and A
namespace for api independent GPU programming
BufferTypeBits
Bits for the selection of different buffer types.
this header is dependency free
cgv::math::fvec< int32_t, 4 > ivec4
declare type of 4d 32 bit integer vectors
cgv::math::fvec< double, 2 > dvec2
declare type of 2d double precision floating point vectors