summaryrefslogtreecommitdiff
path: root/common/texture.h
diff options
context:
space:
mode:
authordocwhat1999-11-14 06:43:18 +0000
committerdocwhat1999-11-14 06:43:18 +0000
commitd71eec8062e852e56f03102ba4b4e87dc485821d (patch)
tree452368ad0e7e24627e517a0c88c2508d02cea6dc /common/texture.h
parent2046090b7ce8dd901ce43e650be5acf44016d714 (diff)
Initial revision
git-svn-id: http://svn.leocad.org/trunk@2 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common/texture.h')
-rw-r--r--common/texture.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/common/texture.h b/common/texture.h
new file mode 100644
index 0000000..546c7c8
--- /dev/null
+++ b/common/texture.h
@@ -0,0 +1,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