source: OGRE/trunk/ogrenew/RenderSystems/GL/include/OgreGLPBRenderTexture.h @ 692

Revision 692, 3.6 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

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