gtsam_points
Loading...
Searching...
No Matches
texture.hpp
Go to the documentation of this file.
1#ifndef GLK_TEXTURE_HPP
2#define GLK_TEXTURE_HPP
3
4#include <vector>
5#include <GL/gl3w.h>
6#include <Eigen/Core>
7
8namespace glk {
9
10class Texture {
11public:
12 Texture(const Eigen::Vector2i& size, GLuint internal_format, GLuint format, GLuint type, const void* pixels = nullptr);
14
15 // Forbid copy
16 Texture(const Texture& temp_obj) = delete;
17 Texture& operator=(const Texture& temp_obj) = delete;
18
19 GLuint id() const;
20 Eigen::Vector2i size() const;
21 void set_size(const Eigen::Vector2i& size);
22
23 void bind() const;
24 void bind(GLenum target) const;
25 void unbind() const;
26 void unbind(GLenum target) const;
27
28 // They are semantically const but not logically const
29 const Texture& set_filer_mode(GLenum mode) const;
30 const Texture& set_clamp_mode(GLenum mode) const;
31
32 template <typename T>
33 std::vector<T> read_pixels(GLuint format = GL_RGBA, GLuint type = GL_UNSIGNED_BYTE, int num_elements = 4) const;
34
35private:
36 int width;
37 int height;
38
39 GLuint internal_format;
40 GLuint format;
41 GLuint type;
42
43 GLuint filter_mode;
44
45 GLuint texture;
46};
47
48class Texture1D {
49public:
50 Texture1D(int width, GLuint internal_format, GLuint format, GLuint type, const void* pixels = nullptr);
52
53 GLuint id() const;
54 int size() const;
55
56private:
57 int width;
58 GLuint texture;
59};
60} // namespace glk
61
62#endif
Definition texture.hpp:48
GLuint id() const
Texture1D(int width, GLuint internal_format, GLuint format, GLuint type, const void *pixels=nullptr)
int size() const
Definition texture.hpp:10
const Texture & set_filer_mode(GLenum mode) const
void set_size(const Eigen::Vector2i &size)
void unbind() const
Texture(const Eigen::Vector2i &size, GLuint internal_format, GLuint format, GLuint type, const void *pixels=nullptr)
void unbind(GLenum target) const
void bind(GLenum target) const
Texture & operator=(const Texture &temp_obj)=delete
std::vector< T > read_pixels(GLuint format=GL_RGBA, GLuint type=GL_UNSIGNED_BYTE, int num_elements=4) const
GLuint id() const
Eigen::Vector2i size() const
void bind() const
Texture(const Texture &temp_obj)=delete
const Texture & set_clamp_mode(GLenum mode) const
Definition async_buffer_copy.hpp:6
std::enable_if_t< needs_aligned_allocator< T >::value, std::shared_ptr< T > > make_shared(Args &&... args)
Definition make_shared.hpp:20