gtsam_points
Loading...
Searching...
No Matches
frame_buffer.hpp
Go to the documentation of this file.
1#ifndef GLK_FRAME_BUFFER_HPP
2#define GLK_FRAME_BUFFER_HPP
3
4#include <memory>
5#include <GL/gl3w.h>
6#include <Eigen/Core>
7
8#include <glk/texture.hpp>
9
10namespace glk {
11
13public:
14 FrameBuffer(const Eigen::Vector2i& size, int num_color_buffers = 1, bool use_depth = true);
15
17
18 void bind();
19 void unbind() const;
20
21 int num_color_buffers() const;
22 glk::Texture& add_color_buffer(int layout, GLuint internal_format, GLuint format, GLuint type);
23 glk::Texture& add_depth_buffer(GLuint internal_format = GL_DEPTH_COMPONENT32F, GLuint format = GL_DEPTH_COMPONENT, GLuint type = GL_FLOAT);
24
25 void bind_ext_depth_buffer(const glk::Texture& depth_texture);
26
27 Eigen::Vector2i size() const;
28 void set_size(const Eigen::Vector2i& size);
29
30 const Texture& color() const;
31 const Texture& color(int i) const;
32 const Texture& depth() const;
33
35 Texture& color(int i);
37
38private:
39 int width;
40 int height;
41
42 GLint viewport[4];
43
44 std::vector<GLenum> color_attachments;
45 std::vector<int> color_buffer_layouts;
46 std::vector<std::shared_ptr<Texture>> color_buffers;
47 std::shared_ptr<Texture> depth_buffer;
48
49 GLuint frame_buffer;
50};
51
52} // namespace glk
53
54#endif
Definition frame_buffer.hpp:12
const Texture & color() const
void unbind() const
Eigen::Vector2i size() const
glk::Texture & add_depth_buffer(GLuint internal_format=GL_DEPTH_COMPONENT32F, GLuint format=GL_DEPTH_COMPONENT, GLuint type=GL_FLOAT)
Texture & color(int i)
const Texture & depth() const
Texture & color()
FrameBuffer(const Eigen::Vector2i &size, int num_color_buffers=1, bool use_depth=true)
int num_color_buffers() const
void bind_ext_depth_buffer(const glk::Texture &depth_texture)
void set_size(const Eigen::Vector2i &size)
Texture & depth()
glk::Texture & add_color_buffer(int layout, GLuint internal_format, GLuint format, GLuint type)
const Texture & color(int i) const
Definition texture.hpp:10
Definition async_buffer_copy.hpp:6