summaryrefslogtreecommitdiff
path: root/common/texture.h
blob: 546c7c8bb6a6b57e333d6083c68d0ef07f343ac9 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
//	texture.h
////////////////////////////////////////////////////

#ifndef _TEXTURE_H
#define _TEXTURE_H

#ifndef GLuint
#include <GL/gl.h>
#endif

class File;

typedef enum { LC_INTENSITY, LC_RGB, LC_RGBA } LC_TEXTURE_TYPES;

class Texture
{
public:
	Texture();
	~Texture();

	void MakeCurrent()
	{
      if (m_nID != 0)
        { glBindTexture(GL_TEXTURE_2D, m_nID); }
	}

	bool IsLoaded()
		{ return glIsTexture(m_nID) == GL_TRUE; }
	void Load(bool bFilter);
	bool LoadFromFile(char* strFilename, bool bFilter);
	void Unload();

	void LoadIndex(File* idx);
	void AddRef(bool bFilter);
	void DeRef();

	// Read-only
	char m_strName[9];
	unsigned short m_nWidth;
	unsigned short m_nHeight;

protected:
	int m_nRef;
	GLuint m_nID;
	GLenum m_nType;
	unsigned long m_nOffset;
};


#endif // _TEXTURE_H