xcal
基于 C++23 的现代图形渲染引擎
载入中...
搜索中...
未找到
framebufferobject.hpp
浏览该文件的文档.
1#include <xcal/public.h>
2
3#include <vector>
8 public:
11
12 private:
13 gl::GLuint fbo_{0};
14 Texture texture_;
15 gl::GLuint width_{};
16 gl::GLuint height_{};
17 color_format_t color_format_{color_format_t::RGBA};
18 pixel_type_t pixel_type_{pixel_type_t::UNSIGNED_BYTE};
19
20 public:
21 FramebufferObject(gl::GLuint width, gl::GLuint height,
22 color_format_t color_format = color_format_t::RGBA,
23 pixel_type_t pixel_type = pixel_type_t::UNSIGNED_BYTE);
25
26 public:
27 bool_t is_valid() const { return fbo_ != 0; }
28 gl::GLuint width() const { return width_; }
29 gl::GLuint height() const { return height_; }
30 const Texture &texture() const { return texture_; }
31 void bind() const;
33 std::swap(fbo_, o.fbo_);
34 texture_.swap(o.texture_);
35 std::swap(width_, o.width_);
36 std::swap(height_, o.height_);
37 std::swap(color_format_, o.color_format_);
38 std::swap(pixel_type_, o.pixel_type_);
39 }
40 std::vector<char> read_pixels_char() const;
41 std::vector<float> read_pixels_float() const;
42 static void unbind();
43};
44} // namespace xcal::render::opengl::GL
std::vector< float > read_pixels_float() const
unsigned int GLuint
Definition typedef.hpp:21
bool bool_t
Definition public.h:28