Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/RenderSystems/GL/include/OgreGLRenderTexture.h @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

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