00001 #ifndef OSDL_GL_TEXTURE_H_
00002 #define OSDL_GL_TEXTURE_H_
00003
00004
00005 #include "OSDLOpenGL.h"
00006
00007 #include "Ceylan.h"
00008
00009 #include <string>
00010
00011
00012
00013 namespace OSDL
00014 {
00015
00016
00017 namespace Video
00018 {
00019
00020
00021
00022 class Surface ;
00023
00024
00025 namespace OpenGL
00026 {
00027
00028
00029
00042 typedef GLU::Int GLTextureIdentifier ;
00043
00044
00045
00047 class OSDL_DLL GLTextureException : public OpenGLException
00048 {
00049
00050 public:
00051
00052
00054 GLTextureException( const std::string & reason ) throw() ;
00055
00057 virtual ~GLTextureException() throw() ;
00058
00059 } ;
00060
00061
00062
00091 class OSDL_DLL GLTexture : public Ceylan::TextDisplayable
00092 {
00093
00094
00095 public:
00096
00097
00098
00106 enum TextureMode { Disabled, OneDim, TwoDim } ;
00107
00108
00109
00119 enum Textureflavour { None, Basic } ;
00120
00121
00122
00139 explicit GLTexture( const std::string imageFilename,
00140 Textureflavour flavour = None )
00141 throw( GLTextureException ) ;
00142
00143
00144
00165 explicit GLTexture( Surface & sourceSurface,
00166 Textureflavour flavour = None )
00167 throw( GLTextureException ) ;
00168
00169
00175 virtual ~GLTexture() throw() ;
00176
00177
00188 virtual bool canBeUploaded() const throw() ;
00189
00190
00199 virtual void upload() throw( GLTextureException ) ;
00200
00201
00214 virtual const std::string toString(
00215 Ceylan::VerbosityLevels level = Ceylan::high )
00216 const throw() ;
00217
00218
00219
00220
00221
00222
00224 static TextureMode GetTextureMode() throw() ;
00225
00226
00228 static void SetTextureMode(
00229 TextureMode newMode = TwoDim ) throw() ;
00230
00231
00238 static TextureMode CurrentTextureMode ;
00239
00240
00241
00250 void SetTextureFlavour( Textureflavour flavour )
00251 throw( GLTextureException ) ;
00252
00253
00254
00255
00256 protected:
00257
00258
00259
00284 void upload( Surface & sourceSurface,
00285 Textureflavour flavour ) throw( GLTextureException ) ;
00286
00287
00288
00296 Surface * _source ;
00297
00298
00303 GLTextureIdentifier _id ;
00304
00305
00306
00307
00308 private:
00309
00310
00311
00320 explicit GLTexture( const GLTexture & source ) throw() ;
00321
00322
00331 GLTexture & operator = ( const GLTexture & source )
00332 throw() ;
00333
00334
00335 } ;
00336
00337 }
00338
00339 }
00340
00341 }
00342
00343
00344
00345 #endif // OSDL_GL_TEXTURE_H_
00346