00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 00026 #ifndef __GLTEXTURE_H__ 00027 #define __GLTEXTURE_H__ 00028 00029 #include "OgreGLPrerequisites.h" 00030 #include "OgrePlatform.h" 00031 #include "OgreRenderTexture.h" 00032 #include "OgreTexture.h" 00033 #include "OgreGLSupport.h" 00034 00035 namespace Ogre { 00036 00037 class GLTexture : public Texture 00038 { 00039 public: 00040 // Constructor, called from SDLTextureManager 00041 GLTexture( const String& name, GLSupport& support, 00042 TextureType texType = TEX_TYPE_2D ); 00043 GLTexture( const String& name, GLSupport& support, TextureType texType, 00044 uint width, uint height, uint num_mips, PixelFormat format, 00045 TextureUsage usage ); 00046 00047 virtual ~GLTexture(); 00048 00049 void load(); 00050 void loadImage( const Image &img ); 00051 void loadImages( const std::vector<Image>& images ); 00052 00053 void unload(); 00054 00055 void createRenderTexture(); 00056 00057 void blitToTexture( const Image& src, 00058 unsigned uStartX, unsigned uStartY ); 00059 00060 // Takes the ogre texture type and returns the appropriate GL one 00061 GLenum getGLTextureType(void) const; 00062 00063 // Takes the ogre texture format and returns the appropriate GL one 00064 GLenum getGLTextureFormat(void) const; 00065 00066 GLuint getGLID() const 00067 { return mTextureID; } 00068 00069 protected: 00070 void generateMipMaps( uchar *data, bool useSoftware, bool isCompressed, 00071 size_t faceNumber ); 00072 uchar* rescaleNPower2( const Image& src ); 00073 private: 00074 GLuint mTextureID; 00075 GLSupport& mGLSupport; 00076 }; 00077 00078 class GLRenderTexture : public RenderTexture 00079 { 00080 public: 00081 GLRenderTexture(const String& name, uint width, uint height) 00082 : RenderTexture(name, width, height) 00083 { 00084 } 00085 00086 void _copyToTexture(void); 00087 00088 bool requiresTextureFlipping() const { return true; } 00089 virtual void writeContentsToFile( const String & filename ) {} 00090 virtual void outputText(int x, int y, const String& text) {} 00091 }; 00092 } 00093 00094 #endif // __GLTEXTURE_H__
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:13 2004