jGL
Loading...
Searching...
No Matches
texture.h
Go to the documentation of this file.
1#ifndef TEXTURE
2#define TEXTURE
3
4#include <glm/glm.hpp>
5
6#include <id.h>
7
8#include <string>
9
10#include <jGL/common.h>
11#include <stb_image.h>
12
13namespace jGL
14{
15
16 class Texture
17 {
18
19 public:
20
21 enum class Type {RGB, RGBA};
22
24 : width(0), height(0), channels(0), id(Id::next())
25 {}
26
27 virtual ~Texture() = default;
28
29 virtual void bind(unsigned unit) = 0;
30
31 bool operator==(const Texture & rhs) const { return this->id == rhs.id; }
32
33 const Id & getId() const { return id; }
34
35 const glm::ivec3 size() const { return glm::ivec3(width, height, channels); }
36
37 protected:
38
40
42
43 };
44
45}
46
47#endif /* TEXTURE */
Definition texture.h:17
const Id & getId() const
Definition texture.h:33
virtual void bind(unsigned unit)=0
int width
Definition texture.h:39
bool operator==(const Texture &rhs) const
Definition texture.h:31
Texture()
Definition texture.h:23
Id id
Definition texture.h:41
virtual ~Texture()=default
int height
Definition texture.h:39
const glm::ivec3 size() const
Definition texture.h:35
int channels
Definition texture.h:39
Type
Definition texture.h:21
A drawable graphic.
Definition id.h:10
Definition id.h:13