Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

glt/texture.h

Go to the documentation of this file.
00001 #ifndef GLT_TEXTURE_H
00002 #define GLT_TEXTURE_H
00003 
00004 /*
00005 
00006   GLT OpenGL C++ Toolkit      
00007   Copyright (C) 2000-2002 Nigel Stewart
00008   Email: nigels.com@gmail.com   WWW: http://www.nigels.com/glt/
00009 
00010   This library is free software; you can redistribute it and/or
00011   modify it under the terms of the GNU Lesser General Public
00012   License as published by the Free Software Foundation; either
00013   version 2.1 of the License, or (at your option) any later version.
00014 
00015   This library is distributed in the hope that it will be useful,
00016   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018   Lesser General Public License for more details.
00019 
00020   You should have received a copy of the GNU Lesser General Public
00021   License along with this library; if not, write to the Free Software
00022   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 
00024 */
00025 
00039 #include <glt/config.h>
00040 #include <glt/gl.h>
00041 
00042 #include <misc/refcount.h>
00043 
00044 #include <iosfwd>
00045 #include <string>
00046 
00052 class GltTexture;
00053 typedef ReferenceCountPtr<GltTexture> GltTexturePtr;
00054 
00055 class GltTexture
00056 {
00057 public:
00058     
00059     //
00060     // Constructor/Destructor
00061     //
00062 
00064     GltTexture(const GLenum target = GL_TEXTURE_2D);
00066     ~GltTexture();
00067 
00068 
00069     //
00070     // Textures can't be copied
00071     //
00072 
00073 private:
00074 
00076     GltTexture(const GltTexture &);
00078     GltTexture &operator=(const GltTexture &);
00079 
00080 public:
00081 
00083     void clear();
00084 
00086     bool init(const void *,const bool mipmap = true);
00088     bool init(const GLsizei width,const GLsizei height,const std::string &image,const bool mipmap = true);
00090     bool init(const GLsizei width,const GLsizei height,const byte *image,const GLsizei channels,const bool mipmap = true);
00091 
00093     void set() const;
00094 
00106     void setWrap(const GLenum s,const GLenum t);
00107 
00123     void setFilter(const GLenum min,const GLenum mag);
00124 
00126     void setGamma(const real gamma);
00127 
00129     void setHSVAdjust(const real hue,const real saturation,const real value);
00130 
00131     //
00132     //
00133     //
00134 
00136     const GLsizei &width()  const;
00137 
00139     const GLsizei &height() const;
00140 
00142     const GLuint   id() const;
00143 
00144     // Serialisation
00145 
00151     typedef enum
00152     {
00153         TEXTURE_TYPE_RGB = 0,           
00154         TEXTURE_TYPE_RGBA,              
00155         TEXTURE_TYPE_GREY,              
00156         TEXTURE_TYPE_GREYA,             
00157         TEXTURE_TYPE_ALPHA,             
00158         TEXTURE_TYPE_BITMAP,            
00159         TEXTURE_TYPE_INDEXED_RGB,       
00160         TEXTURE_TYPE_INDEXED_RGBA,      
00162         // Add new types to the end, for compatibility
00163 
00164     } GltTextureType;
00165 
00167     static bool  makeHeader(std::string &header,const int type,const int width,const int height,const int alignment,const int compressed);
00169     static void *getHeader(const void * const h,int &type,int &width,int &height,int &alignment,int &compressed);
00170 
00171 private:
00172 
00173     GLenum  _target;
00174 
00175     GLint   _components;
00176     GLsizei _width;
00177     GLsizei _height;
00178     GLint   _border;
00179     GLenum  _format;
00180     GLenum  _type;
00181     GLint   _alignment;
00182 
00183     GLenum  _wrapS,_wrapT;
00184     GLenum  _filterMin,_filterMag;
00185 
00186     real _gamma;
00187     real _hue,_saturation,_value;
00188 
00189     GLuint  _id;            // OpenGL texture ID
00190 };
00191 
00192 #endif

Generated on Tue Nov 5 11:11:03 2002 for GLT by doxygen1.2.18