1 | <html> |
---|
2 | <head> |
---|
3 | <title>OgreGLTexture.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
4 | <link type="text/css" rel="stylesheet" href="style.css"> |
---|
5 | </head> |
---|
6 | |
---|
7 | <body> |
---|
8 | <!-- Generated by Doxygen 1.3.6 --> |
---|
9 | <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> |
---|
10 | <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> |
---|
11 | 00002 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
12 | 00003 <span class="comment">This source file is part of OGRE</span> |
---|
13 | 00004 <span class="comment"> (Object-oriented Graphics Rendering Engine)</span> |
---|
14 | 00005 <span class="comment">For the latest info, see http://www.ogre3d.org/</span> |
---|
15 | 00006 <span class="comment"></span> |
---|
16 | 00007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span> |
---|
17 | 00008 <span class="comment">Also see acknowledgements in Readme.html</span> |
---|
18 | 00009 <span class="comment"></span> |
---|
19 | 00010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span> |
---|
20 | 00011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span> |
---|
21 | 00012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span> |
---|
22 | 00013 <span class="comment">version.</span> |
---|
23 | 00014 <span class="comment"></span> |
---|
24 | 00015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span> |
---|
25 | 00016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span> |
---|
26 | 00017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span> |
---|
27 | 00018 <span class="comment"></span> |
---|
28 | 00019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span> |
---|
29 | 00020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span> |
---|
30 | 00021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span> |
---|
31 | 00022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span> |
---|
32 | 00023 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
33 | 00024 <span class="comment">*/</span> |
---|
34 | 00025 |
---|
35 | 00026 <span class="preprocessor">#ifndef __GLTEXTURE_H__</span> |
---|
36 | 00027 <span class="preprocessor"></span><span class="preprocessor">#define __GLTEXTURE_H__</span> |
---|
37 | 00028 <span class="preprocessor"></span> |
---|
38 | 00029 <span class="preprocessor">#include "<a class="code" href="OgreGLPrerequisites_8h.html">OgreGLPrerequisites.h</a>"</span> |
---|
39 | 00030 <span class="preprocessor">#include "<a class="code" href="OgrePlatform_8h.html">OgrePlatform.h</a>"</span> |
---|
40 | 00031 <span class="preprocessor">#include "<a class="code" href="OgreRenderTexture_8h.html">OgreRenderTexture.h</a>"</span> |
---|
41 | 00032 <span class="preprocessor">#include "<a class="code" href="OgreTexture_8h.html">OgreTexture.h</a>"</span> |
---|
42 | 00033 <span class="preprocessor">#include "<a class="code" href="OgreGLSupport_8h.html">OgreGLSupport.h</a>"</span> |
---|
43 | 00034 <span class="preprocessor">#include "<a class="code" href="OgreHardwarePixelBuffer_8h.html">OgreHardwarePixelBuffer.h</a>"</span> |
---|
44 | 00035 |
---|
45 | 00036 <span class="keyword">namespace </span>Ogre { |
---|
46 | 00037 |
---|
47 | <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> |
---|
48 | 00039 { |
---|
49 | 00040 <span class="keyword">public</span>: |
---|
50 | 00041 <span class="comment">// Constructor</span> |
---|
51 | 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, |
---|
52 | 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, |
---|
53 | 00044 <a class="code" href="classOgre_1_1GLSupport.html">GLSupport</a>& support); |
---|
54 | 00045 |
---|
55 | 00046 <span class="keyword">virtual</span> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea1">~GLTexture</a>(); |
---|
56 | 00047 |
---|
57 | 00048 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea2">loadImage</a>( <span class="keyword">const</span> <a class="code" href="classOgre_1_1Image.html">Image</a>& img ); |
---|
58 | 00049 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea3">createRenderTexture</a>(); |
---|
59 | 00050 |
---|
60 | 00052 <a class="code" href="classOgre_1_1HardwarePixelBufferSharedPtr.html">HardwarePixelBufferSharedPtr</a> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea4">getBuffer</a>(size_t face, size_t mipmap); |
---|
61 | 00053 |
---|
62 | 00054 <span class="comment">// Takes the OGRE texture type (1d/2d/3d/cube) and returns the appropriate GL one</span> |
---|
63 | 00055 <a class="code" href="OgreGLPrerequisites_8h.html#a41">GLenum</a> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea5">getGLTextureTarget</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
64 | 00056 |
---|
65 | <a name="l00057"></a><a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea6">00057</a> GLuint <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturea6">getGLID</a>()<span class="keyword"> const</span> |
---|
66 | 00058 <span class="keyword"> </span>{ <span class="keywordflow">return</span> mTextureID; } |
---|
67 | 00059 |
---|
68 | 00060 <span class="keyword">protected</span>: |
---|
69 | 00062 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTextureb0">createInternalResourcesImpl</a>(<span class="keywordtype">void</span>); |
---|
70 | 00064 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTextureb1">loadImpl</a>(<span class="keywordtype">void</span>); |
---|
71 | 00066 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTextureb2">freeInternalResourcesImpl</a>(<span class="keywordtype">void</span>); |
---|
72 | 00067 |
---|
73 | 00073 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTextureb3">_createSurfaceList</a>(); |
---|
74 | 00074 <span class="keyword">private</span>: |
---|
75 | <a name="l00075"></a><a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturer0">00075</a> GLuint mTextureID; |
---|
76 | <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; |
---|
77 | 00077 |
---|
78 | <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; |
---|
79 | <a name="l00080"></a><a class="code" href="classOgre_1_1GLTexture.html#Ogre_1_1GLTexturer2">00080</a> SurfaceList mSurfaceList; |
---|
80 | 00081 }; |
---|
81 | 00082 |
---|
82 | <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> |
---|
83 | 00090 { |
---|
84 | 00091 <span class="keyword">public</span>: |
---|
85 | <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>>() {} |
---|
86 | <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) {} |
---|
87 | <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) {} |
---|
88 | <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>>() |
---|
89 | 00096 { |
---|
90 | 00097 <span class="comment">// lock & copy other mutex pointer</span> |
---|
91 | 00098 <a class="code" href="OgrePrerequisites_8h.html#a14">OGRE_LOCK_MUTEX</a>(*r.OGRE_AUTO_MUTEX_NAME) |
---|
92 | 00099 <a class="code" href="OgrePrerequisites_8h.html#a19">OGRE_COPY_AUTO_SHARED_MUTEX</a>(r.OGRE_AUTO_MUTEX_NAME) |
---|
93 | 00100 pRep = static_cast<GLTexture*>(r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra12">getPointer</a>()); |
---|
94 | 00101 pUseCount = r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra11">useCountPointer</a>(); |
---|
95 | 00102 <span class="keywordflow">if</span> (pUseCount) |
---|
96 | 00103 { |
---|
97 | 00104 ++(*pUseCount); |
---|
98 | 00105 } |
---|
99 | 00106 } |
---|
100 | 00107 |
---|
101 | <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) |
---|
102 | 00110 { |
---|
103 | 00111 <span class="keywordflow">if</span> (pRep == static_cast<GLTexture*>(r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra12">getPointer</a>())) |
---|
104 | 00112 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
105 | 00113 <a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtrb0">release</a>(); |
---|
106 | 00114 <span class="comment">// lock & copy other mutex pointer</span> |
---|
107 | 00115 <a class="code" href="OgrePrerequisites_8h.html#a14">OGRE_LOCK_MUTEX</a>(*r.OGRE_AUTO_MUTEX_NAME) |
---|
108 | 00116 <a class="code" href="OgrePrerequisites_8h.html#a19">OGRE_COPY_AUTO_SHARED_MUTEX</a>(r.OGRE_AUTO_MUTEX_NAME) |
---|
109 | 00117 pRep = static_cast<GLTexture*>(r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra12">getPointer</a>()); |
---|
110 | 00118 pUseCount = r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra11">useCountPointer</a>(); |
---|
111 | 00119 <span class="keywordflow">if</span> (pUseCount) |
---|
112 | 00120 { |
---|
113 | 00121 ++(*pUseCount); |
---|
114 | 00122 } |
---|
115 | 00123 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
116 | 00124 } |
---|
117 | <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) |
---|
118 | 00127 { |
---|
119 | 00128 <span class="keywordflow">if</span> (pRep == static_cast<GLTexture*>(r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra12">getPointer</a>())) |
---|
120 | 00129 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
121 | 00130 <a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtrb0">release</a>(); |
---|
122 | 00131 <span class="comment">// lock & copy other mutex pointer</span> |
---|
123 | 00132 <a class="code" href="OgrePrerequisites_8h.html#a14">OGRE_LOCK_MUTEX</a>(*r.OGRE_AUTO_MUTEX_NAME) |
---|
124 | 00133 <a class="code" href="OgrePrerequisites_8h.html#a19">OGRE_COPY_AUTO_SHARED_MUTEX</a>(r.OGRE_AUTO_MUTEX_NAME) |
---|
125 | 00134 pRep = static_cast<GLTexture*>(r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra12">getPointer</a>()); |
---|
126 | 00135 pUseCount = r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra11">useCountPointer</a>(); |
---|
127 | 00136 <span class="keywordflow">if</span> (pUseCount) |
---|
128 | 00137 { |
---|
129 | 00138 ++(*pUseCount); |
---|
130 | 00139 } |
---|
131 | 00140 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
132 | 00141 } |
---|
133 | 00142 }; |
---|
134 | 00143 |
---|
135 | <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> |
---|
136 | 00146 { |
---|
137 | 00147 <span class="keyword">public</span>: |
---|
138 | <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, |
---|
139 | 00149 <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a62">NameValuePairList</a> *miscParams) |
---|
140 | 00150 : <a class="code" href="classOgre_1_1RenderTexture.html">RenderTexture</a>(name, width, height, texType, format) |
---|
141 | 00151 { |
---|
142 | 00152 <a class="code" href="classOgre_1_1GLRenderTexture.html#Ogre_1_1Win32RenderTexturep6">mGLTexture</a> = mTexture; |
---|
143 | 00153 } |
---|
144 | 00154 |
---|
145 | 00155 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLRenderTexture.html#Ogre_1_1GLXRenderTexturea2">_copyToTexture</a>(<span class="keywordtype">void</span>); |
---|
146 | 00156 |
---|
147 | <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>; } |
---|
148 | 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 ); |
---|
149 | 00159 <span class="keyword">protected</span>: |
---|
150 | <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>; |
---|
151 | 00161 }; |
---|
152 | 00162 } |
---|
153 | 00163 |
---|
154 | 00164 <span class="preprocessor">#endif // __GLTEXTURE_H__</span> |
---|
155 | </pre></div><hr> |
---|
156 | <p> |
---|
157 | Copyright © 2000-2005 by The OGRE Team<br /> |
---|
158 | <!--Creative Commons License--><a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights20.png"/></a><br/> |
---|
159 | This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-ShareAlike 2.5 License</a>.<br/> |
---|
160 | <!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
---|
161 | <Work rdf:about=""> |
---|
162 | <license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" /> |
---|
163 | <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" /> |
---|
164 | </Work> |
---|
165 | <License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF> --> |
---|
166 | |
---|
167 | Last modified Sun Feb 12 12:59:45 2006 |
---|
168 | </p> |
---|
169 | </body> |
---|
170 | </html> |
---|