summaryrefslogtreecommitdiff
path: root/include/gltexture.h
blob: 06f2e8ac60249b1e04a4ecc8386f9856689f7c88 (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
#ifndef __GLTEXTURE_H__
#define __GLTEXTURE_H__

#include <SDL.h>
#include <SDL_opengl.h>
#include <Handle.h>
#include <Exceptions.h>

namespace mogltk {
    enum texture_type {
	RAW_RGBA,
    };
    class texture : public Base {
      public:
          texture(int = 256, int = 256, bool = false) throw (GeneralException);
	  texture(Handle *, bool = false, texture_type = RAW_RGBA) throw (GeneralException);
	  virtual ~texture();
	SDL_Surface * GetSurface();
	static SDL_Surface * LoadNTEX(Handle * h) throw (GeneralException) ;
	void Generate();
	void Bind(bool = true);
	GLuint GetWidth();
	GLuint GetHeight();
	static void Unbind(void);
	void Taint(void);
      private:
        GLuint width, height, tex;
	bool texture_allocated;
	SDL_Surface * surface;
	bool planar, tainted;
#ifdef TRACE_TEXTURES
	static texture * header;
	static texture * footer;
	texture * next, * prev;
#endif
	static texture * active;
    };
};

#endif