summaryrefslogtreecommitdiff
path: root/include/texture.h
blob: 4f14ba4644f6819dcbbe1808267aecca3ed9192c (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
#ifndef __TEXTURE_H__
#define __TEXTURE_H__

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

namespace mogltk {
    class texture : public Base {
      public:
          texture(int = 256, int = 256, bool = false) throw (GeneralException);
	  texture(Handle *, bool = false) throw (GeneralException);
	  virtual ~texture();
	SDL_Surface * GetSurface();
	Uint32 * GetPixels();
	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