CmGLTexture.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. Copyright (c) 2000-2011 Torus Knot Software Ltd
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. THE SOFTWARE.
  22. -----------------------------------------------------------------------------
  23. */
  24. #ifndef __GLTEXTURE_H__
  25. #define __GLTEXTURE_H__
  26. #include "CmGLPrerequisites.h"
  27. #include "CmRenderTexture.h"
  28. #include "CmTexture.h"
  29. #include "CmGLSupport.h"
  30. #include "CmHardwarePixelBuffer.h"
  31. namespace CamelotEngine {
  32. class CM_RSGL_EXPORT GLTexture : public Texture
  33. {
  34. public:
  35. virtual ~GLTexture();
  36. /// @copydoc Texture::getBuffer
  37. HardwarePixelBufferPtr getBuffer_internal(UINT32 face, UINT32 mipmap);
  38. // Takes the OGRE texture type (1d/2d/3d/cube) and returns the appropriate GL one
  39. GLenum getGLTextureTarget_internal(void) const;
  40. GLuint getGLID_internal() const;
  41. void getCustomAttribute_internal(const String& name, void* pData);
  42. protected:
  43. friend class GLTextureManager;
  44. // Constructor
  45. GLTexture(GLSupport& support);
  46. void initialize_internal();
  47. /// @copydoc Texture::createInternalResourcesImpl
  48. void createInternalResourcesImpl(void);
  49. /// @copydoc Resource::freeInternalResourcesImpl
  50. void freeInternalResourcesImpl(void);
  51. /** internal method, create GLHardwarePixelBuffers for every face and
  52. mipmap level. This method must be called after the GL texture object was created,
  53. the number of mipmaps was set (GL_TEXTURE_MAX_LEVEL) and glTexImageXD was called to
  54. actually allocate the buffer
  55. */
  56. void createSurfaceList();
  57. void createRenderTexture();
  58. private:
  59. GLuint mTextureID;
  60. GLSupport& mGLSupport;
  61. /// Vector of pointers to subsurfaces
  62. typedef vector<HardwarePixelBufferPtr>::type SurfaceList;
  63. SurfaceList mSurfaceList;
  64. };
  65. typedef std::shared_ptr<GLTexture> GLTexturePtr;
  66. }
  67. #endif // __GLTEXTURE_H__