[5] | 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-2006 Torus Knot Software Ltd |
---|
| 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 | You may alternatively use this source under the terms of a specific version of |
---|
| 25 | the OGRE Unrestricted License provided you have obtained such a license from |
---|
| 26 | Torus Knot Software Ltd. |
---|
| 27 | ----------------------------------------------------------------------------- |
---|
| 28 | */ |
---|
| 29 | |
---|
| 30 | #ifndef __GLPBRENDERTEXTURE_H__ |
---|
| 31 | #define __GLPBRENDERTEXTURE_H__ |
---|
| 32 | |
---|
| 33 | #include "OgreGLRenderTexture.h" |
---|
| 34 | #include "OgreGLPBuffer.h" |
---|
| 35 | namespace Ogre { |
---|
| 36 | |
---|
| 37 | /** RenderTexture that uses a PBuffer (offscreen rendering context) for rendering. |
---|
| 38 | */ |
---|
| 39 | class GLPBRTTManager; |
---|
| 40 | class _OgrePrivate GLPBRenderTexture: public GLRenderTexture |
---|
| 41 | { |
---|
| 42 | public: |
---|
| 43 | GLPBRenderTexture(GLPBRTTManager *manager, const String &name, const GLSurfaceDesc &target); |
---|
| 44 | virtual ~GLPBRenderTexture(); |
---|
| 45 | |
---|
| 46 | virtual void getCustomAttribute(const String& name, void* pData); |
---|
| 47 | protected: |
---|
| 48 | GLPBRTTManager *mManager; |
---|
| 49 | PixelComponentType mPBFormat; |
---|
| 50 | }; |
---|
| 51 | |
---|
| 52 | /** Manager for rendertextures and PBuffers (offscreen rendering contexts) |
---|
| 53 | */ |
---|
| 54 | class _OgrePrivate GLPBRTTManager: public GLRTTManager |
---|
| 55 | { |
---|
| 56 | public: |
---|
| 57 | GLPBRTTManager(GLSupport *support, RenderTarget *mainwindow); |
---|
| 58 | virtual ~GLPBRTTManager(); |
---|
| 59 | |
---|
| 60 | /** @copydoc GLRTTManager::createRenderTexture |
---|
| 61 | */ |
---|
| 62 | virtual RenderTexture *createRenderTexture(const String &name, const GLSurfaceDesc &target); |
---|
| 63 | |
---|
| 64 | /** @copydoc GLRTTManager::checkFormat |
---|
| 65 | */ |
---|
| 66 | virtual bool checkFormat(PixelFormat format); |
---|
| 67 | |
---|
| 68 | /** @copydoc GLRTTManager::bind |
---|
| 69 | */ |
---|
| 70 | virtual void bind(RenderTarget *target); |
---|
| 71 | |
---|
| 72 | /** @copydoc GLRTTManager::unbind |
---|
| 73 | */ |
---|
| 74 | virtual void unbind(RenderTarget *target); |
---|
| 75 | |
---|
| 76 | /** Create PBuffer for a certain pixel format and size |
---|
| 77 | */ |
---|
| 78 | void requestPBuffer(PixelComponentType ctype, size_t width, size_t height); |
---|
| 79 | |
---|
| 80 | /** Release PBuffer for a certain pixel format |
---|
| 81 | */ |
---|
| 82 | void releasePBuffer(PixelComponentType ctype); |
---|
| 83 | |
---|
| 84 | /** Get GL rendering context for a certain component type and size. |
---|
| 85 | */ |
---|
| 86 | GLContext *getContextFor(PixelComponentType ctype, size_t width, size_t height); |
---|
| 87 | protected: |
---|
| 88 | /** GLSupport reference, used to create PBuffers */ |
---|
| 89 | GLSupport *mSupport; |
---|
| 90 | /** Primary window reference */ |
---|
| 91 | RenderTarget *mMainWindow; |
---|
| 92 | /** Primary window context */ |
---|
| 93 | GLContext *mMainContext; |
---|
| 94 | /** Reference to a PBuffer, with refcount */ |
---|
| 95 | struct PBRef |
---|
| 96 | { |
---|
| 97 | PBRef(): pb(0),refcount(0) {} |
---|
| 98 | GLPBuffer* pb; |
---|
| 99 | size_t refcount; |
---|
| 100 | }; |
---|
| 101 | /** Type to map each component type to a PBuffer */ |
---|
| 102 | PBRef mPBuffers[PCT_COUNT]; |
---|
| 103 | }; |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | #endif // __GLPBRENDERTEXTURE_H__ |
---|