[692] | 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-2005 The OGRE Team
|
---|
| 8 | Also see acknowledgements in Readme.html
|
---|
| 9 |
|
---|
| 10 | This program is free software; you can redistribute it and/or modify it under
|
---|
| 11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
| 12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
| 13 | version.
|
---|
| 14 |
|
---|
| 15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
| 16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
| 17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
| 18 |
|
---|
| 19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
| 20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
| 21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
| 22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
| 23 | -----------------------------------------------------------------------------
|
---|
| 24 | */
|
---|
| 25 |
|
---|
| 26 | #ifndef __GLRENDERTEXTURE_H__
|
---|
| 27 | #define __GLRENDERTEXTURE_H__
|
---|
| 28 |
|
---|
| 29 | #include "OgreGLTexture.h"
|
---|
| 30 |
|
---|
| 31 | namespace Ogre {
|
---|
| 32 | /** GL surface descriptor. Points to a 2D surface that can be rendered to.
|
---|
| 33 | */
|
---|
| 34 | struct GLSurfaceDesc
|
---|
| 35 | {
|
---|
| 36 | public:
|
---|
| 37 | GLHardwarePixelBuffer *buffer;
|
---|
| 38 | size_t zoffset;
|
---|
| 39 | };
|
---|
| 40 |
|
---|
| 41 | /** Base class for GL Render Textures
|
---|
| 42 | */
|
---|
| 43 | class GLRenderTexture: public RenderTexture
|
---|
| 44 | {
|
---|
| 45 | public:
|
---|
| 46 | GLRenderTexture(const String &name, const GLSurfaceDesc &target);
|
---|
| 47 | virtual ~GLRenderTexture();
|
---|
| 48 |
|
---|
| 49 | bool requiresTextureFlipping() const { return true; }
|
---|
| 50 | };
|
---|
| 51 |
|
---|
| 52 | /** Manager/factory for RenderTextures.
|
---|
| 53 | */
|
---|
| 54 | class GLRTTManager: public Singleton<GLRTTManager>
|
---|
| 55 | {
|
---|
| 56 | public:
|
---|
| 57 | virtual ~GLRTTManager();
|
---|
| 58 |
|
---|
| 59 | /** Create a texture rendertarget object
|
---|
| 60 | */
|
---|
| 61 | virtual RenderTexture *createRenderTexture(const String &name, const GLSurfaceDesc &target) = 0;
|
---|
| 62 |
|
---|
| 63 | /** Check if a certain format is usable as rendertexture format
|
---|
| 64 | */
|
---|
| 65 | virtual bool checkFormat(PixelFormat format) = 0;
|
---|
| 66 |
|
---|
| 67 | /** Bind a certain render target.
|
---|
| 68 | */
|
---|
| 69 | virtual void bind(RenderTarget *target) = 0;
|
---|
| 70 |
|
---|
| 71 | /** Unbind a certain render target. This is called before binding another RenderTarget, and
|
---|
| 72 | before the context is switched. It can be used to do a copy, or just be a noop if direct
|
---|
| 73 | binding is used.
|
---|
| 74 | */
|
---|
| 75 | virtual void unbind(RenderTarget *target) = 0;
|
---|
| 76 |
|
---|
| 77 | /** Create a multi render target
|
---|
| 78 | */
|
---|
| 79 | virtual MultiRenderTarget* createMultiRenderTarget(const String & name);
|
---|
| 80 |
|
---|
| 81 | /** Get the closest supported alternative format. If format is supported, returns format.
|
---|
| 82 | */
|
---|
| 83 | virtual PixelFormat getSupportedAlternative(PixelFormat format);
|
---|
| 84 | };
|
---|
| 85 |
|
---|
| 86 | /** RenderTexture for simple copying from frame buffer
|
---|
| 87 | */
|
---|
| 88 | class GLCopyingRTTManager;
|
---|
| 89 | class GLCopyingRenderTexture: public GLRenderTexture
|
---|
| 90 | {
|
---|
| 91 | public:
|
---|
| 92 | GLCopyingRenderTexture(GLCopyingRTTManager *manager, const String &name, const GLSurfaceDesc &target);
|
---|
| 93 |
|
---|
| 94 | virtual void getCustomAttribute(const String& name, void* pData);
|
---|
| 95 | };
|
---|
| 96 |
|
---|
| 97 | /** Simple, copying manager/factory for RenderTextures. This is only used as the last fallback if
|
---|
| 98 | both PBuffers and FBOs aren't supported.
|
---|
| 99 | */
|
---|
| 100 | class GLCopyingRTTManager: public GLRTTManager
|
---|
| 101 | {
|
---|
| 102 | public:
|
---|
| 103 | GLCopyingRTTManager();
|
---|
| 104 | virtual ~GLCopyingRTTManager();
|
---|
| 105 |
|
---|
| 106 | /** @copydoc GLRTTManager::createRenderTexture
|
---|
| 107 | */
|
---|
| 108 | virtual RenderTexture *createRenderTexture(const String &name, const GLSurfaceDesc &target);
|
---|
| 109 |
|
---|
| 110 | /** @copydoc GLRTTManager::checkFormat
|
---|
| 111 | */
|
---|
| 112 | virtual bool checkFormat(PixelFormat format);
|
---|
| 113 |
|
---|
| 114 | /** @copydoc GLRTTManager::bind
|
---|
| 115 | */
|
---|
| 116 | virtual void bind(RenderTarget *target);
|
---|
| 117 |
|
---|
| 118 | /** @copydoc GLRTTManager::unbind
|
---|
| 119 | */
|
---|
| 120 | virtual void unbind(RenderTarget *target);
|
---|
| 121 | };
|
---|
| 122 | }
|
---|
| 123 |
|
---|
| 124 | #endif // __GLTEXTURE_H__
|
---|