| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /********************************************************************** 00002 VRS - The Virtual Rendering System 00003 Copyright (C) 2001 Computer Graphics Systems Group at the 00004 Hasso-Plattner-Institute, Potsdam, Germany. 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 This library is distributed in the hope that it will be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 See the GNU Lesser General Public License for more details. 00013 You should have received a copy of the GNU Lesser+ General Public 00014 License along with this library; if not, write to the FreeSoftware 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA, 02111-1307, USA. 00016 **********************************************************************/ 00017 00018 // $Id: imagetexture2dgl.h 6557 2008-11-24 12:30:44Z Manuel_Wellmann $ 00019 // $Date: 2008-11-24 13:30:44 +0100 (Mon, 24 Nov 2008) $ 00020 // $Revision: 6557 $ 00021 // $State$ 00022 // $Author: Manuel_Wellmann $ 00023 // 00024 // $Log$ 00025 // Revision 1.16 2005/10/13 09:52:35 baumann 00026 // mipmap handling improved 00027 // 00028 // Revision 1.15 2005/09/25 15:30:39 baumann 00029 // acceptChildren() implemented 00030 // 00031 // Revision 1.14 2005/06/15 16:30:02 baumann 00032 // added methods SharedObj::isEqual() and SharedObj::IsEqual() (define operator==() in derived classes for a real implementaton) 00033 // 00034 // Revision 1.13 2005/01/03 01:43:09 klimetschek 00035 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00036 // - removed vrs.vcproj 00037 // minor things: 00038 // - added all glutexamples to vrs4glut.sln 00039 // - fixed some problems in glutexamples 00040 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00041 // 00042 // Revision 1.12 2004/11/03 14:45:06 saar 00043 // Class comment changed (Doxygen style) 00044 // 00045 // Revision 1.11 2004/03/12 16:28:40 baumann 00046 // macros VRS_NAMESPACE_BEGIN/_END expanded and removed 00047 // 00048 // Revision 1.10 2004/01/19 11:43:58 baumann 00049 // serialization mechanism improved 00050 // 00051 // Revision 1.9 2003/11/06 10:13:53 baumann 00052 // added member ImageTexture2DGL::unrefImageAfterBinding_InternalFormat_ 00053 // 00054 // Revision 1.8 2003/10/30 10:59:12 skirsch 00055 // added comment on unrefImageAfterBinding 00056 // 00057 // Revision 1.7 2003/07/31 11:08:09 baumann 00058 // flag unrefImageAfterBinding (re-)added 00059 // 00060 // Revision 1.6 2003/06/23 07:07:58 baumann 00061 // forward declaring VRS::Image 00062 // 00063 // Revision 1.5 2002/12/11 16:06:09 kirsch 00064 // use Matrix() instead of Matrix::identity in default constructor 00065 // 00066 // Revision 1.4 2002/11/13 07:20:50 baumann 00067 // changed TextureGL enum values to uppercase 00068 // added TextureGL::definesComponent() 00069 // 00070 // Revision 1.3 2002/10/29 10:32:52 baumann 00071 // macros VRS_CLASSNAME_* and VRS_IMPL_TYPEINFO_* removed 00072 // 00073 // Revision 1.2 2002/04/07 17:14:11 baumann 00074 // Matrix::identity() changed to Matrix::identity 00075 // 00076 // Revision 1.1 2002/03/04 12:00:20 kersting 00077 // directory structure changes 00078 // 00079 // Revision 1.8 2002/03/03 21:44:26 kosta 00080 // VRS_TYPEINFO-macro rewritten 00081 // 00082 // Revision 1.7 2002/02/19 10:34:19 kosta 00083 // undone all changes since 2002-02-15 00084 // 00085 // Revision 1.4 2002/02/05 07:48:26 kosta 00086 // new persistency macros: 00087 // VRS_SERIALIZABLE(CLASS_NAME); 00088 // VRS_SERIALIZABLE_ABSTRACT_CLASS(CLASS_NAME); 00089 // VRS_SERIALIZABLE_NO_SO_CLASS(CLASS_NAME) 00090 // 00091 // Revision 1.3 2002/02/04 13:07:19 kosta 00092 // VRS_SERIALIZABLE macros completely rewritten 00093 // 00094 // Revision 1.2 2002/01/15 16:25:55 kosta 00095 // macros rewritten for a better namespace support 00096 // 00097 // Revision 1.1 2002/01/08 16:02:49 kosta 00098 // dir structure for textures changed 00099 // 00100 // Revision 1.7 2002/01/08 09:29:54 kosta 00101 // code cleanup 00102 // 00103 // Revision 1.6 2001/11/21 10:25:38 nienhaus 00104 // combine mode moved to opengl texture environment attribute 00105 // 00106 // Revision 1.5 2001/11/14 10:22:14 kirsch 00107 // GCC fix: replaced improper FilterMode default argument in constructor 00108 // 00109 // Revision 1.4 2001/11/13 16:36:31 kirsch 00110 // changed line feed to unix style (removed control-M) 00111 // 00112 // Revision 1.3 2001/08/26 10:46:11 kosta 00113 // texture painters refined and simplified 00114 // 00115 // Revision 1.2 2001/08/20 15:07:58 kersting 00116 // added classname to enumeration 00117 // 00118 // Revision 1.1 2001/07/25 21:27:46 kosta 00119 // new texture mechanism implemented 00120 // 00121 00122 #ifndef VRS_OPENGL_TEXTURE_IMAGETEXTURE2DGL_H 00123 #define VRS_OPENGL_TEXTURE_IMAGETEXTURE2DGL_H 00124 00125 #include <vrs/opengl/texture2dgl.h> 00126 00127 namespace VRS { 00128 00129 class Image; 00130 00132 class VRS_CORE_API ImageTexture2DGL : public Texture2DGL { 00133 public: 00134 ImageTexture2DGL(Image* image, 00135 TextureGL::WrapMode wrapS = TextureGL::REPEAT, 00136 TextureGL::WrapMode wrapT = TextureGL::REPEAT, 00137 TextureGL::FilterMode minFilter = TextureGL::TRILINEAR, 00138 TextureGL::FilterMode magFilter = TextureGL::LINEAR, 00139 GLfloat anisotropic = 1.0, 00140 const Matrix& matrix = Matrix(), 00141 const Color& borderColor = Color(0.0f, 0.0f, 0.0f, 0.0f), // transparent black 00142 GLenum internalFormat = GL_ZERO, 00143 bool unrefImageAfterBindung = false); 00154 bool operator==(const ImageTexture2DGL& other) const; 00155 00156 virtual void setImage(Image* newImage, GLenum internalFormat = GL_ZERO); 00157 virtual Image* getImage() const; 00161 virtual bool isMipmap() const; 00162 00163 virtual GLenum getInternalFormat() const; 00164 00165 void unrefImageAfterBinding() const; 00167 00168 VRS_TYPEINFO(ImageTexture2DGL, Texture2DGL); 00169 VRS_SERIALIZABLE(ImageTexture2DGL); 00170 00171 protected: 00172 ImageTexture2DGL(); // only for serialization!!! 00173 00174 virtual void acceptChildren(std::vector<Visitable*>& appendChildrenHere) const; 00175 00176 friend class ImageTexture2DPainterGL; 00177 00178 private: 00179 SO<Image> image_; 00180 bool isPow2_; 00181 mutable bool unrefImageAfterBinding_; 00182 mutable GLenum unrefImageAfterBinding_TextureTarget_; 00183 mutable GLenum unrefImageAfterBinding_InternalFormat_; 00184 mutable Matrix unrefImageAfterBinding_AdjustedMatrix_; 00185 }; 00186 00187 } // namespace VRS 00188 00189 #endif // VRS_OPENGL_TEXTURE_IMAGETEXTURE2DGL_H