-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTexture.h
47 lines (27 loc) · 923 Bytes
/
Texture.h
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
36
37
38
39
40
41
42
43
44
45
46
#ifndef _TEXTURE_INCLUDE
#define _TEXTURE_INCLUDE
#include <string>
#include <GL/glew.h>
using namespace std;
enum PixelFormat {TEXTURE_PIXEL_FORMAT_RGB, TEXTURE_PIXEL_FORMAT_RGBA};
// The texture class loads images an passes them to OpenGL
// storing the returned id so that it may be applied to any drawn primitives
class Texture
{
public:
Texture();
bool loadFromFile(const string &filename, PixelFormat format);
void loadFromGlyphBuffer(unsigned char *buffer, int width, int height);
void createEmptyTexture(int width, int height);
void loadSubtextureFromGlyphBuffer(unsigned char *buffer, int x, int y, int width, int height);
void generateMipmap();
void setWrapS(GLint value);
void setWrapT(GLint value);
void setMinFilter(GLint value);
void setMagFilter(GLint value);
void use() const;
private:
GLuint texId;
GLint wrapS, wrapT, minFilter, magFilter;
};
#endif // _TEXTURE_INCLUDE