blob: ddd4f395d83d343e181fd31c5606d33dae4d320c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#pragma once
#include "rendering/texture.h"
#include <glad/glad.h>
namespace Donut
{
class OpenGLTexture2D
: public Texture2D
{
public:
OpenGLTexture2D(uint32_t width, uint32_t height);
OpenGLTexture2D(const std::string& path);
virtual ~OpenGLTexture2D();
virtual uint32_t get_width() const override { return m_width; }
virtual uint32_t get_height() const override { return m_height; }
virtual uint32_t get_renderer_id() const override { return m_renderer_id; }
virtual void set_data(void* data, uint32_t size) override;
virtual void bind(uint32_t slot = 0) const override;
virtual void bind_as_image(uint32_t slot = 0, bool read_only = false) const override;
virtual bool operator==(const Texture& other) const override
{
return m_renderer_id == other.get_renderer_id();
}
private:
std::string m_path;
uint32_t m_width, m_height;
uint32_t m_renderer_id;
GLenum m_internal_format, m_data_format;
};
}
|