]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture.h
Windows compatibility:
[libs/gl.git] / source / texture.h
index 7c29865747e79f6e7972bc329885303ea09fe52e..28f9cb328979efdcefc0c6934e250da56748cdb7 100644 (file)
@@ -1,7 +1,14 @@
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2007  Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
 #ifndef MSP_GL_TEXTURE_H_
 #define MSP_GL_TEXTURE_H_
 
-#include <GL/gl.h>
+#include "gl.h"
 #include "types.h"
 
 namespace Msp {
@@ -17,36 +24,33 @@ enum TextureFilter
        LINEAR_MIPMAP_LINEAR   = GL_LINEAR_MIPMAP_LINEAR
 };
 
-enum TextureFormat
-{
-       LUMINANCE8,
-       LUMINANCE8_ALPHA8,
-       RGB8,
-       RGBA8,
-       BGR8,
-       BGRA8
-};
-
+/**
+Base class for textures.  This class only defines operations common for all
+texture types and is not instantiable.  For specifying images for textures, see
+one of the dimensioned texture classes.
+*/
 class Texture
 {
 public:
+       ~Texture();
+
        void bind() const;
        void parameter(GLenum, int);
        void parameter(GLenum, float);
        void set_min_filter(TextureFilter f) { parameter(GL_TEXTURE_MIN_FILTER, f); }
        void set_mag_filter(TextureFilter f) { parameter(GL_TEXTURE_MAG_FILTER, f); }
+       GLenum get_target() const            { return target; }
        uint  get_id() const                 { return id; }
-       sizei get_width(int =0) const;
-       sizei get_height(int =0) const;
-       sizei get_depth(int =0) const;
-       ~Texture();
+
+       static void unbind();
 protected:
        uint   id;
        GLenum target;
 
        Texture();
-
-       static const Texture *bound;
+       Texture(const Texture &);
+       Texture &operator=(const Texture &);
+       void maybe_bind() const;
 };
 
 } // namespace GL