xcal
基于 C++23 的现代图形渲染引擎
载入中...
搜索中...
未找到
texture.hpp
浏览该文件的文档.
1#include <xcal/public.h>
2
4
6class FramebufferObject;
7class Texture {
8 friend class ::xcal::render::opengl::GL::FramebufferObject;
9
10 public:
11 enum class color_format_t {
12 RGB,
13 RGBA,
14 DEPTH,
15 STENCIL,
16 };
17 enum class pixel_type_t {
19 FLOAT,
20 };
21
22 private:
23 gl::GLuint texture_ = 0;
24 gl::GLenum target_{};
25
26 public:
27 Texture(const Texture &) = delete;
28 Texture(Texture &&o) { swap(o); }
29 Texture &operator=(const Texture &) = delete;
31 swap(o);
32 return *this;
33 }
34 Texture(gl::GLenum target);
35 ~Texture();
36 bool_t is_valid() const { return texture_ != 0; }
37 void image_2d(gl::GLint level, color_format_t internalformat,
38 gl::GLsizei width, gl::GLsizei height, gl::GLint border,
39 color_format_t format, pixel_type_t type,
40 const void *data) const;
41 void parameteri(gl::GLenum pname, gl::GLenum param) const;
42 void bind(gl::GLenum target) const;
43 void bind() const;
44 void unbind();
45 void swap(Texture &o);
46 static void unbind(gl::GLenum target);
47 static gl::GLenum to_gl_enum(color_format_t format);
48 static gl::GLenum to_gl_enum(pixel_type_t type);
49};
50} // namespace xcal::render::opengl::GL
Texture & operator=(const Texture &)=delete
static gl::GLenum to_gl_enum(color_format_t format)
Definition texture.cc:22
void image_2d(gl::GLint level, color_format_t internalformat, gl::GLsizei width, gl::GLsizei height, gl::GLint border, color_format_t format, pixel_type_t type, const void *data) const
Definition texture.cc:44
Texture & operator=(Texture &&o)
Definition texture.hpp:30
Texture(const Texture &)=delete
void parameteri(gl::GLenum pname, gl::GLenum param) const
Definition texture.cc:12
int GLint
Definition typedef.hpp:17
int GLsizei
Definition typedef.hpp:18
unsigned int GLuint
Definition typedef.hpp:21
bool bool_t
Definition public.h:28