OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreGLTexture.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __GLTEXTURE_H__
30 #define __GLTEXTURE_H__
31 
32 #include "OgreGLPrerequisites.h"
33 #include "OgrePlatform.h"
34 #include "OgreRenderTexture.h"
35 #include "OgreTexture.h"
36 #include "OgreGLSupport.h"
38 
39 namespace Ogre {
40 
42  {
43  public:
44  // Constructor
45  GLTexture(ResourceManager* creator, const String& name, ResourceHandle handle,
46  const String& group, bool isManual, ManualResourceLoader* loader,
47  GLSupport& support);
48 
49  virtual ~GLTexture();
50 
51  void createRenderTexture();
52 
54  HardwarePixelBufferSharedPtr getBuffer(size_t face, size_t mipmap);
55 
57  GLenum getGLTextureTarget(void) const;
58 
59  GLuint getGLID() const
60  {
61  if( mFSAA > 0 )
62  {
63  //Before GL 3.3, only implicit resolves are supported.
64  for( size_t face=0; face<getNumFaces(); ++face )
65  {
66  RenderTarget *renderTarget = mSurfaceList[face * (mNumMipmaps+1)]->getRenderTarget();
67  if( renderTarget->isFsaaResolveDirty() )
68  renderTarget->swapBuffers();
69  }
70  }
71 
72  return mTextureID;
73  }
74 
75  void getCustomAttribute(const String& name, void* pData);
76 
77  protected:
79  void createInternalResourcesImpl(void);
81  void prepareImpl(void);
83  void unprepareImpl(void);
85  void loadImpl(void);
87  void freeInternalResourcesImpl(void);
88 
94  void _createSurfaceList();
95 
98 
104 
105 
106  private:
107  GLuint mTextureID;
109 
113  };
114 }
115 
116 #endif // __GLTEXTURE_H__
A 'canvas' which can receive the results of a rendering operation.
Interface describing a manual resource loader.
Definition: OgreResource.h:498
LoadedImages mLoadedImages
Vector of images that were pulled from disk by prepareLoad but have yet to be pushed into texture mem...
SharedPtr< vector< Image >::type > LoadedImages
Used to hold images between calls to prepare and load.
Definition: OgreGLTexture.h:97
#define _OgreGLExport
bool isFsaaResolveDirty(void) const
GLuint getGLID() const
Definition: OgreGLTexture.h:59
Shared pointer implementation used to share pixel buffers.
unsigned long long int ResourceHandle
Definition: OgreResource.h:39
GLSupport & mGLSupport
vector< HardwarePixelBufferSharedPtr >::type SurfaceList
Vector of pointers to subsurfaces.
Defines a generic resource handler.
Reference-counted shared pointer, used for objects where implicit destruction is required.
_StringBase String
Definition: OgreCommon.h:53
SurfaceList mSurfaceList
Abstract class representing a Texture resource.
Definition: OgreTexture.h:111
virtual void swapBuffers(void)
Swaps the frame buffers to display the next frame.