cgv
Loading...
Searching...
No Matches
gl_depth_peeler.h
1#pragma once
2
3#include <cgv/render/texture.h>
4
5#include "lib_begin.h"
6
7namespace cgv {
8 namespace render {
9 namespace gl {
10
11
44class CGV_API gl_depth_peeler
45{
46protected:
47 unsigned int query;
48 texture depth_texture;
49 float depth_bias;
50 bool front_to_back;
51 context* ctx_ptr;
52 bool _invert_t;
53public:
55 mutable std::string last_error;
57 gl_depth_peeler(bool front_to_back = true, float _depth_bias = 0.001);
59 virtual ~gl_depth_peeler();
61 void invert_t(bool enable = true);
63 void set_back_to_front();
65 void set_front_to_back();
67 bool is_front_to_back() const;
69 virtual void destruct(context& ctx);
71 void set_depth_bias(float bias);
73 float get_depth_bias() const;
75 bool is_initialized() const;
77 virtual bool init(context& ctx);
79 virtual void init_frame(context& ctx);
81 void copy_depth_buffer(context& ctx);
83 void begin_layer(context& ctx, int tex_unit = -1);
85 unsigned int end_layer(context& ctx);
86};
87
88
89 }
90 }
91}
92
93#include <cgv/config/lib_end.h>
base class for all drawables, which is independent of the used rendering API.
Definition context.h:670
void copy_depth_buffer(context &ctx)
copies the current depth buffer to the second depth buffer, what is typically done before peeling a l...
bool is_front_to_back() const
return whether the mode is front to back
bool is_initialized() const
check whether the depth peeler has been initialized, i.e. the init method has been called successfull...
void begin_layer(context &ctx, int tex_unit=-1)
start to extract the next layer. Within begin_layer and end_layer the following OpenGL features are u...
virtual bool init(context &ctx)
checks for extensions and init depth peeler, return success
unsigned int end_layer(context &ctx)
finish the layer and return the number of drawn fragments in the layer. All OpenGL settings are resto...
std::string last_error
a string that contains the last error, which is only set by the init method
gl_depth_peeler(bool front_to_back=true, float _depth_bias=0.001)
construct uninitialized depth peeler
void set_front_to_back()
enable front to back mode
void set_depth_bias(float bias)
the depth bias is used as epsilon for the test against the second depth buffer and is initialized to ...
virtual void destruct(context &ctx)
destruct the depth peeler
float get_depth_bias() const
return the current depth bias
void invert_t(bool enable=true)
set the sign for the vertical texture coordinate. In case of some ATI-cards this needs to be enabled ...
void set_back_to_front()
enable back to front mode
virtual void init_frame(context &ctx)
call this after the viewport has been set and before the first call to copy_depth_buffer or begin_lay...
the texture class encapsulates all functionality independent of the rendering api.
Definition texture.h:15
namespace for opengl specific GPU programming
Definition gl.cxx:6
namespace for api independent GPU programming
this header is dependency free
Definition print.h:11