-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtexture.h
More file actions
31 lines (24 loc) · 941 Bytes
/
Copy pathtexture.h
File metadata and controls
31 lines (24 loc) · 941 Bytes
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
///////////////////////////////////////////////////////////////////////
// A slight encapsulation of an OpenGL texture. This contains a method
// to read an image file into a texture, and methods to bind a texture
// to a shader for use, and unbind when done.
////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#ifndef _TEXTURE_
#define _TEXTURE_
// This class reads an image from a file, stores it on the graphics
// card as a texture, and stores the (small integer) texture id which
// identifies it. It also supplies two methods for binding and
// unbinding the texture to/from a shader.
class Texture
{
public:
unsigned int textureId;
int width, height, depth;
unsigned char* image;
Texture();
Texture(const std::string &filename);
void BindTexture(const int unit, const int programId, const std::string& name);
void UnbindTexture(const int unit);
};
#endif