xcal
基于 C++23 的现代图形渲染引擎
载入中...
搜索中...
未找到
xcal
render
impl
opengl
gl
framebufferobject.hpp
浏览该文件的文档.
1
#include <
xcal/public.h
>
2
3
#include <vector>
4
#include <
xcal/render/impl/opengl/core/typedef.hpp
>
5
#include <
xcal/render/impl/opengl/gl/texture.hpp
>
6
namespace
xcal::render::opengl::GL
{
7
class
FramebufferObject
{
8
public
:
9
using
color_format_t
=
Texture::color_format_t
;
10
using
pixel_type_t
=
Texture::pixel_type_t
;
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);
24
~FramebufferObject
();
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
;
32
void
swap
(
FramebufferObject
&o) {
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
xcal::render::opengl::GL::FramebufferObject
Definition
framebufferobject.hpp:7
xcal::render::opengl::GL::FramebufferObject::unbind
static void unbind()
Definition
framebufferobject.cc:4
xcal::render::opengl::GL::FramebufferObject::height
gl::GLuint height() const
Definition
framebufferobject.hpp:29
xcal::render::opengl::GL::FramebufferObject::width
gl::GLuint width() const
Definition
framebufferobject.hpp:28
xcal::render::opengl::GL::FramebufferObject::read_pixels_char
std::vector< char > read_pixels_char() const
Definition
framebufferobject.cc:37
xcal::render::opengl::GL::FramebufferObject::read_pixels_float
std::vector< float > read_pixels_float() const
Definition
framebufferobject.cc:46
xcal::render::opengl::GL::FramebufferObject::is_valid
bool_t is_valid() const
Definition
framebufferobject.hpp:27
xcal::render::opengl::GL::FramebufferObject::texture
const Texture & texture() const
Definition
framebufferobject.hpp:30
xcal::render::opengl::GL::FramebufferObject::pixel_type_t
Texture::pixel_type_t pixel_type_t
Definition
framebufferobject.hpp:10
xcal::render::opengl::GL::FramebufferObject::swap
void swap(FramebufferObject &o)
Definition
framebufferobject.hpp:32
xcal::render::opengl::GL::FramebufferObject::~FramebufferObject
~FramebufferObject()
Definition
framebufferobject.cc:30
xcal::render::opengl::GL::FramebufferObject::color_format_t
Texture::color_format_t color_format_t
Definition
framebufferobject.hpp:9
xcal::render::opengl::GL::FramebufferObject::bind
void bind() const
Definition
framebufferobject.cc:33
xcal::render::opengl::GL::Texture
Definition
texture.hpp:7
xcal::render::opengl::GL::Texture::color_format_t
color_format_t
Definition
texture.hpp:11
xcal::render::opengl::GL::Texture::swap
void swap(Texture &o)
Definition
texture.cc:36
xcal::render::opengl::GL::Texture::pixel_type_t
pixel_type_t
Definition
texture.hpp:17
gl::GLuint
unsigned int GLuint
Definition
typedef.hpp:21
xcal::render::opengl::GL
Definition
rendercommand.hpp:7
xcal::bool_t
bool bool_t
Definition
public.h:28
public.h
texture.hpp
typedef.hpp
生成于 2025年 九月 19日 星期五 21:12:12 , 为 xcal使用
1.9.8