summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2003-02-09 19:29:34 +0000
committerpixel <pixel>2003-02-09 19:29:34 +0000
commit6b63855d6e31a4d63ced9c803847ee35c70ee514 (patch)
tree35bc4826caab46add73a81751a3840c6ad9a2689
parent2ce366684532475971543bfdfa7abeb001354371 (diff)
Whoups..
-rw-r--r--include/gltexture.h5
-rw-r--r--lib/gltexture.cc6
-rw-r--r--src/test.cc3
3 files changed, 9 insertions, 5 deletions
diff --git a/include/gltexture.h b/include/gltexture.h
index 2a5ab0b..bcfed2d 100644
--- a/include/gltexture.h
+++ b/include/gltexture.h
@@ -7,10 +7,13 @@
#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) throw (GeneralException);
+ texture(Handle *, bool = false, texture_type = RAW_RGBA) throw (GeneralException);
virtual ~texture();
SDL_Surface * GetSurface();
void Generate();
diff --git a/lib/gltexture.cc b/lib/gltexture.cc
index b674c50..601d24f 100644
--- a/lib/gltexture.cc
+++ b/lib/gltexture.cc
@@ -21,7 +21,7 @@ mogltk::texture * mogltk::texture::active = 0;
mogltk::texture::texture(int w, int h, bool plane) throw (GeneralException) : width(w), height(h),
texture_allocated(false), planar(plane), tainted(true) {
- if ((BITCOUNT(w) != 1) || (BITCOUNT(h) != 1))
+ if ((!ISPOT(w)) || (!ISPOT(h)))
throw GeneralException(_("Size of the texture not a power of 2!"));
if (!(surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32,
@@ -53,7 +53,7 @@ mogltk::texture::texture(int w, int h, bool plane) throw (GeneralException) : wi
#endif
}
-mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
+mogltk::texture::texture(Handle * h, bool plane, texture_type ttype) throw (GeneralException) :
texture_allocated(false), planar(plane), tainted(true) {
SDL_Surface * temp;
@@ -68,7 +68,7 @@ mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
width = temp->w;
height = temp->h;
- if ((BITCOUNT(width) != 1) || (BITCOUNT(height) != 1)) {
+ if ((!ISPOT(width)) || (!ISPOT(height))) {
SDL_FreeSurface(temp);
throw GeneralException(_("Size of the texture not a power of 2!"));
}
diff --git a/src/test.cc b/src/test.cc
index a25f7a1..0bb2fde 100644
--- a/src/test.cc
+++ b/src/test.cc
@@ -12,13 +12,14 @@ CODE_BEGINS
virtual int startup() throw (GeneralException) {
verbosity = M_INFO;
mogltk::glbase::setup();
+ new Archive("datas.paq");
Input * fonte = new Input("font-2.bin");
mogltk::font font(fonte);
delete fonte;
verbosity = M_INFO;
- Input * pattern = new Input("pattern6.bmp");
+ Input * pattern = new Input("pattern6.rgba");
mogltk::texture * mytex = new mogltk::texture(pattern, true);
delete pattern;