<html> <head> <title>OgreGLTexture.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link type="text/css" rel="stylesheet" href="style.css"> </head> <body> <!-- Generated by Doxygen 1.3.6 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div> <h1>OgreGLTexture.h</h1><a href="OgreGLTexture_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span> 00002 <span class="comment">-----------------------------------------------------------------------------</span> 00003 <span class="comment">This source file is part of OGRE</span> 00004 <span class="comment"> (Object-oriented Graphics Rendering Engine)</span> 00005 <span class="comment">For the latest info, see http://www.ogre3d.org/</span> 00006 <span class="comment"></span> 00007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span> 00008 <span class="comment">Also see acknowledgements in Readme.html</span> 00009 <span class="comment"></span> 00010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span> 00011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span> 00012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span> 00013 <span class="comment">version.</span> 00014 <span class="comment"></span> 00015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span> 00016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span> 00017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span> 00018 <span class="comment"></span> 00019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span> 00020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span> 00021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span> 00022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span> 00023 <span class="comment">-----------------------------------------------------------------------------</span> 00024 <span class="comment">*/</span> 00025 00026 <span class="preprocessor">#ifndef __GLTEXTURE_H__</span> 00027 <span class="preprocessor"></span><span class="preprocessor">#define __GLTEXTURE_H__</span> 00028 <span class="preprocessor"></span> 00029 <span class="preprocessor">#include "<a class="code" href="OgreGLPrerequisites_8h.html">OgreGLPrerequisites.h</a>"</span> 00030 <span class="preprocessor">#include "<a class="code" href="OgrePlatform_8h.html">OgrePlatform.h</a>"</span> 00031 <span class="preprocessor">#include "<a class="code" href="OgreRenderTexture_8h.html">OgreRenderTexture.h</a>"</span> 00032 <span class="preprocessor">#include "<a class="code" href="OgreTexture_8h.html">OgreTexture.h</a>"</span> 00033 <span class="preprocessor">#include "<a class="code" href="OgreGLSupport_8h.html">OgreGLSupport.h</a>"</span> 00034 <span class="preprocessor">#include "<a class="code" href="OgreHardwarePixelBuffer_8h.html">OgreHardwarePixelBuffer.h</a>"</span> 00035 00036 <span class="keyword">namespace </span>Ogre { 00037 <a name="l00038"></a><a class="code" href="classOgre_1_1GLTexture.html">00038</a> <span class="keyword">class </span><a class="code" href="classOgre_1_1GLTexture.html">GLTexture</a> : <span class="keyword">public</span> <a class="code" href="classOgre_1_1Texture.html">Texture</a> 00039 { 00040 <span class="keyword">public</span>: 00041 <span class="comment">// Constructor</span> 00042 <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea0">GLTexture</a>(<a class="code" href="classOgre_1_1ResourceManager.html">ResourceManager</a>* creator, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& name, <a class="code" href="namespaceOgre.html#a485">ResourceHandle</a> handle, 00043 <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& group, <span class="keywordtype">bool</span> isManual, <a class="code" href="classOgre_1_1ManualResourceLoader.html">ManualResourceLoader</a>* loader, 00044 <a class="code" href="classOgre_1_1GLSupport.html">GLSupport</a>& support); 00045 00046 <span class="keyword">virtual</span> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea1">~GLTexture</a>(); 00047 00049 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea2">createInternalResources</a>(<span class="keywordtype">void</span>); 00050 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea3">loadImage</a>( <span class="keyword">const</span> <a class="code" href="classOgre_1_1Image.html">Image</a>& img ); 00051 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea4">createRenderTexture</a>(); 00052 00054 <a class="code" href="classOgre_1_1HardwarePixelBufferSharedPtr.html">HardwarePixelBufferSharedPtr</a> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea5">getBuffer</a>(size_t face, size_t mipmap); 00055 00056 <span class="comment">// Takes the OGRE texture type (1d/2d/3d/cube) and returns the appropriate GL one</span> 00057 <a class="code" href="OgreGLPrerequisites_8h.html#a39">GLenum</a> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea6">getGLTextureTarget</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>; 00058 <a name="l00059"></a><a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea7">00059</a> GLuint <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea7">getGLID</a>()<span class="keyword"> const</span> 00060 <span class="keyword"> </span>{ <span class="keywordflow">return</span> mTextureID; } 00061 00062 <span class="keyword">protected</span>: 00064 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTextureb0">loadImpl</a>(<span class="keywordtype">void</span>); 00066 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTextureb1">unloadImpl</a>(<span class="keywordtype">void</span>); 00067 00073 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTextureb2">_createSurfaceList</a>(); 00074 <span class="keyword">private</span>: <a name="l00075"></a><a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturer0">00075</a> GLuint mTextureID; <a name="l00076"></a><a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturer1">00076</a> <a class="code" href="classOgre_1_1GLSupport.html">GLSupport</a>& mGLSupport; 00077 <a name="l00079"></a><a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturey0">00079</a> <span class="keyword">typedef</span> std::vector<HardwarePixelBufferSharedPtr> SurfaceList; <a name="l00080"></a><a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturer2">00080</a> SurfaceList mSurfaceList; 00081 }; 00082 <a name="l00089"></a><a class="code" href="classOgre_1_1GLTexturePtr.html">00089</a> <span class="keyword">class </span><a class="code" href="classOgre_1_1GLTexturePtr.html">GLTexturePtr</a> : <span class="keyword">public</span> <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a><GLTexture> 00090 { 00091 <span class="keyword">public</span>: <a name="l00092"></a><a class="code" href="classOgre_1_1GLTexturePtr.html#Ogre_1_1GLTexturePtra0">00092</a> <a class="code" href="classOgre_1_1GLTexturePtr.html#Ogre_1_1GLTexturePtra0">GLTexturePtr</a>() : <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a><<a class="code" href="classOgre_1_1GLTexture.html">GLTexture</a>>() {} <a name="l00093"></a><a class="code" href="classOgre_1_1GLTexturePtr.html#Ogre_1_1GLTexturePtra1">00093</a> <span class="keyword">explicit</span> <a class="code" href="classOgre_1_1GLTexturePtr.html#Ogre_1_1GLTexturePtra0">GLTexturePtr</a>(<a class="code" href="classOgre_1_1GLTexture.html">GLTexture</a>* rep) : <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a><<a class="code" href="classOgre_1_1GLTexture.html">GLTexture</a>>(rep) {} <a name="l00094"></a><a class="code" href="classOgre_1_1GLTexturePtr.html#Ogre_1_1GLTexturePtra2">00094</a> <a class="code" href="classOgre_1_1GLTexturePtr.html#Ogre_1_1GLTexturePtra0">GLTexturePtr</a>(<span class="keyword">const</span> <a class="code" href="classOgre_1_1GLTexturePtr.html">GLTexturePtr</a>& r) : <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a><<a class="code" href="classOgre_1_1GLTexture.html">GLTexture</a>>(r) {} <a name="l00095"></a><a class="code" href="classOgre_1_1GLTexturePtr.html#Ogre_1_1GLTexturePtra3">00095</a> <a class="code" href="classOgre_1_1GLTexturePtr.html#Ogre_1_1GLTexturePtra0">GLTexturePtr</a>(<span class="keyword">const</span> <a class="code" href="classOgre_1_1SharedPtr.html">ResourcePtr</a>& r) : <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a><<a class="code" href="classOgre_1_1GLTexture.html">GLTexture</a>>() 00096 { 00097 <span class="comment">// lock & copy other mutex pointer</span> 00098 <a class="code" href="OgrePrerequisites_8h.html#a14">OGRE_LOCK_MUTEX</a>(*r.OGRE_AUTO_MUTEX_NAME) 00099 <a class="code" href="OgrePrerequisites_8h.html#a19">OGRE_COPY_AUTO_SHARED_MUTEX</a>(r.OGRE_AUTO_MUTEX_NAME) 00100 pRep = static_cast<GLTexture*>(r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra12">getPointer</a>()); 00101 pUseCount = r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra11">useCountPointer</a>(); 00102 <span class="keywordflow">if</span> (pUseCount) 00103 { 00104 ++(*pUseCount); 00105 } 00106 } 00107 <a name="l00109"></a><a class="code" href="classOgre_1_1GLTexturePtr.html#Ogre_1_1GLTexturePtra4">00109</a> <a class="code" href="classOgre_1_1GLTexturePtr.html">GLTexturePtr</a>& <a class="code" href="classOgre_1_1GLTexturePtr.html#Ogre_1_1GLTexturePtra4">operator=</a>(<span class="keyword">const</span> <a class="code" href="classOgre_1_1SharedPtr.html">ResourcePtr</a>& r) 00110 { 00111 <span class="keywordflow">if</span> (pRep == static_cast<GLTexture*>(r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra12">getPointer</a>())) 00112 <span class="keywordflow">return</span> *<span class="keyword">this</span>; 00113 <a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtrb0">release</a>(); 00114 <span class="comment">// lock & copy other mutex pointer</span> 00115 <a class="code" href="OgrePrerequisites_8h.html#a14">OGRE_LOCK_MUTEX</a>(*r.OGRE_AUTO_MUTEX_NAME) 00116 <a class="code" href="OgrePrerequisites_8h.html#a19">OGRE_COPY_AUTO_SHARED_MUTEX</a>(r.OGRE_AUTO_MUTEX_NAME) 00117 pRep = static_cast<GLTexture*>(r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra12">getPointer</a>()); 00118 pUseCount = r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra11">useCountPointer</a>(); 00119 <span class="keywordflow">if</span> (pUseCount) 00120 { 00121 ++(*pUseCount); 00122 } 00123 <span class="keywordflow">return</span> *<span class="keyword">this</span>; 00124 } <a name="l00126"></a><a class="code" href="classOgre_1_1GLTexturePtr.html#Ogre_1_1GLTexturePtra5">00126</a> <a class="code" href="classOgre_1_1GLTexturePtr.html">GLTexturePtr</a>& <a class="code" href="classOgre_1_1GLTexturePtr.html#Ogre_1_1GLTexturePtra4">operator=</a>(<span class="keyword">const</span> <a class="code" href="classOgre_1_1TexturePtr.html">TexturePtr</a>& r) 00127 { 00128 <span class="keywordflow">if</span> (pRep == static_cast<GLTexture*>(r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra12">getPointer</a>())) 00129 <span class="keywordflow">return</span> *<span class="keyword">this</span>; 00130 <a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtrb0">release</a>(); 00131 <span class="comment">// lock & copy other mutex pointer</span> 00132 <a class="code" href="OgrePrerequisites_8h.html#a14">OGRE_LOCK_MUTEX</a>(*r.OGRE_AUTO_MUTEX_NAME) 00133 <a class="code" href="OgrePrerequisites_8h.html#a19">OGRE_COPY_AUTO_SHARED_MUTEX</a>(r.OGRE_AUTO_MUTEX_NAME) 00134 pRep = static_cast<GLTexture*>(r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra12">getPointer</a>()); 00135 pUseCount = r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra11">useCountPointer</a>(); 00136 <span class="keywordflow">if</span> (pUseCount) 00137 { 00138 ++(*pUseCount); 00139 } 00140 <span class="keywordflow">return</span> *<span class="keyword">this</span>; 00141 } 00142 }; 00143 <a name="l00145"></a><a class="code" href="classOgre_1_1GLRenderTexture.html">00145</a> <span class="keyword">class </span><a class="code" href="classOgre_1_1GLRenderTexture.html">GLRenderTexture</a> : <span class="keyword">public</span> <a class="code" href="classOgre_1_1RenderTexture.html">RenderTexture</a> 00146 { 00147 <span class="keyword">public</span>: <a name="l00148"></a><a class="code" href="classOgre_1_1GLRenderTexture.html#Ogre_1_1GLRenderTexturea0">00148</a> <a class="code" href="classOgre_1_1GLRenderTexture.html#Ogre_1_1GLRenderTexturea0">GLRenderTexture</a>(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& name, <a class="code" href="namespaceOgre.html#a423">uint</a> width, <a class="code" href="namespaceOgre.html#a423">uint</a> height, TextureType texType, PixelFormat format, 00149 <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a62">NameValuePairList</a> *miscParams) 00150 : <a class="code" href="classOgre_1_1RenderTexture.html">RenderTexture</a>(name, width, height, texType, format) 00151 { 00152 <a class="code" href="classOgre_1_1GLRenderTexture.html#Ogre_1_1Win32RenderTexturep6">mGLTexture</a> = mTexture; 00153 } 00154 00155 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLRenderTexture.html#Ogre_1_1GLXRenderTexturea2">_copyToTexture</a>(<span class="keywordtype">void</span>); 00156 <a name="l00157"></a><a class="code" href="classOgre_1_1GLRenderTexture.html#Ogre_1_1Win32RenderTexturea2">00157</a> <span class="keywordtype">bool</span> <a class="code" href="classOgre_1_1GLRenderTexture.html#Ogre_1_1Win32RenderTexturea2">requiresTextureFlipping</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="keyword">true</span>; } 00158 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLRenderTexture.html#Ogre_1_1Win32RenderTexturea3">writeContentsToFile</a>( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a> & filename ); 00159 <span class="keyword">protected</span>: <a name="l00160"></a><a class="code" href="classOgre_1_1GLRenderTexture.html#Ogre_1_1Win32RenderTexturep6">00160</a> <a class="code" href="classOgre_1_1GLTexturePtr.html">GLTexturePtr</a> <a class="code" href="classOgre_1_1GLRenderTexture.html#Ogre_1_1Win32RenderTexturep6">mGLTexture</a>; 00161 }; 00162 } 00163 00164 <span class="preprocessor">#endif // __GLTEXTURE_H__</span> </pre></div><p> Copyright © 2000-2005 by The OGRE Team<br /> Last modified Wed Feb 23 00:19:06 2005 </p> </body> </html>