cgv
Loading...
Searching...
No Matches
gl_transparent_renderer.h
1#pragma once
2
3#include <cgv/render/texture.h>
4#include <cgv/render/frame_buffer.h>
5
6#include "gl_depth_peeler.h"
7
8#include "lib_begin.h"
9
10namespace cgv {
11 namespace render {
12 namespace gl {
13
14
26{
27protected:
30 // depth texture used as depth buffer used in offline rendering
31 texture depth_buffer;
32 // texture to store the peeled layers, which is used as color buffer in offline rendering and as texture during blending
33 texture layer_tex;
36 // frame buffer object used for offline rendering of the layers
37 frame_buffer fb;
39 void create_and_attach_texture(context& ctx, texture& tex, int w, int h, int i = -1);
41 void blend_texture_over_viewport(context& ctx, texture& tex);
42public:
44 mutable std::string last_error;
46 cgv::signal::signal<context&> render_callback;
48 cgv::signal::signal<context&,texture&> render_callback_2;
50 gl_transparent_renderer(bool front_to_back = true, float _depth_bias = 0.001);
52 bool init(context& ctx);
54 void init_frame(context& ctx);
56 int render_transparent(context& ctx, int max_nr_layers, int tex_unit = -1);
58 void destruct(context& ctx);
59};
60
61
62 }
63 }
64}
65
66#include <cgv/config/lib_end.h>
base class for all drawables, which is independent of the used rendering API.
Definition context.h:621
this class encapsulate frame buffers that live on the GPU and can be used as destination for the rend...
OpenGL helper class to simplify depth peeling.
OpenGL helper class to simplify transparent rendering.
cgv::signal::signal< context &, texture & > render_callback_2
signal called to render the transparent content for second and further layers with additional depth t...
cgv::signal::signal< context & > render_callback
signal called to render the transparent content for first layer without additional depth test
gl_depth_peeler peeler
depth peeler used for visibility sorting
texture color_tex
texture used as color buffer in front to back mode to blend together all transparent layers before bl...
std::string last_error
a string that contains the last error, which is only set by the init method
the texture class encapsulates all functionality independent of the rendering api.
Definition texture.h:15
the cgv namespace
Definition print.h:11