| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /********************************************************************** 00002 VRS - The Virtual Rendering System 00003 Copyright (C) 2001 Computer Graphics Systems Group at the 00004 Hasso-Plattner-Institute, Potsdam, Germany. 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 This library is distributed in the hope that it will be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 See the GNU Lesser General Public License for more details. 00013 You should have received a copy of the GNU Lesser+ General Public 00014 License along with this library; if not, write to the FreeSoftware 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA, 02111-1307, USA. 00016 **********************************************************************/ 00017 // $Id: pbuffercanvasgl.h 6628 2009-01-13 14:08:52Z Manuel_Wellmann $ 00018 // $Date: 2009-01-13 15:08:52 +0100 (Tue, 13 Jan 2009) $ 00019 // $Revision: 6628 $ 00020 // $State$ 00021 // $Author: Manuel_Wellmann $ 00022 // 00023 // $Log$ 00024 // Revision 1.36 2005/01/03 01:43:09 klimetschek 00025 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00026 // - removed vrs.vcproj 00027 // minor things: 00028 // - added all glutexamples to vrs4glut.sln 00029 // - fixed some problems in glutexamples 00030 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00031 // 00032 // Revision 1.35 2004/11/09 15:07:24 kirsch 00033 // further changes to class comments due to doxygen 00034 // 00035 // Revision 1.34 2004/11/03 14:45:06 saar 00036 // Class comment changed (Doxygen style) 00037 // 00038 // Revision 1.33 2004/03/12 16:28:40 baumann 00039 // macros VRS_NAMESPACE_BEGIN/_END expanded and removed 00040 // 00041 // Revision 1.32 2003/12/11 15:11:07 kirsch 00042 // made prepareRedisplay() and finishRedisplay() public 00043 // 00044 // Revision 1.31 2003/10/27 13:40:38 skirsch 00045 // added canvas query functionality to the engine, restructured canvas redisplay, and added dpi query functionality to the canvas 00046 // 00047 // Revision 1.30 2003/01/28 09:39:27 kirsch 00048 // make PBufferManager a protected friend of PBufferCanvas 00049 // 00050 // Revision 1.29 2002/11/29 11:42:35 skirsch 00051 // fixed some bugs (restoring the context) but not all, which occur, when using a pbuffer without creating another gl canvas before 00052 // 00053 // Revision 1.28 2002/11/22 10:33:01 kirsch 00054 // added updateTextureArea 00055 // 00056 // Revision 1.27 2002/11/08 11:04:49 baumann 00057 // mipmap flag added to method newTexture() 00058 // 00059 // Revision 1.26 2002/11/01 12:00:43 kirsch 00060 // impl cleanups 00061 // 00062 // Revision 1.25 2002/10/29 10:32:52 baumann 00063 // macros VRS_CLASSNAME_* and VRS_IMPL_TYPEINFO_* removed 00064 // 00065 // Revision 1.24 2002/10/24 14:15:25 kirsch 00066 // made canvas width and height unsigned 00067 // added getProperties to GLCanvas and subclasses 00068 // 00069 // Revision 1.23 2002/10/24 06:49:55 baumann 00070 // new method added: redisplay(Texture2DGL* texture) 00071 // 00072 // Revision 1.22 2002/09/19 07:44:19 kirsch 00073 // added GLCanvas::create() and GLCanvas::destroy() 00074 // all sub-classes use those methods to create and destroy engine and processor 00075 // 00076 // Revision 1.21 2002/08/23 15:13:35 baumann 00077 // added properties argument to c'tor (default value is: RGBADS) 00078 // 00079 // Revision 1.20 2002/08/22 14:11:18 baumann 00080 // new static method isSupported() added 00081 // 00082 // Revision 1.19 2002/07/15 12:24:42 kirsch 00083 // added experimental support for WGL_ARB_render_texture, 00084 // and basic support for cube map textures 00085 // 00086 // Revision 1.18 2002/04/16 15:47:41 baumann 00087 // checking if bound texture format matches the specified parameters (for glCopyTexSubImage2D()) 00088 // 00089 // Revision 1.17 2002/04/11 11:06:34 baumann 00090 // code cleanup 00091 // fixed bugs when used in combination with Qt 00092 // 00093 // Revision 1.16 2002/03/04 12:00:26 kersting 00094 // directory structure changes 00095 // 00096 // Revision 1.15 2002/03/03 21:44:26 kosta 00097 // VRS_TYPEINFO-macro rewritten 00098 // 00099 // Revision 1.14 2002/02/19 10:34:19 kosta 00100 // undone all changes since 2002-02-15 00101 // 00102 // Revision 1.11 2002/02/06 13:28:39 kersting 00103 // added newTexture method and renamed readTexture to updateTexture 00104 // 00105 // Revision 1.10 2002/01/15 16:25:55 kosta 00106 // macros rewritten for a better namespace support 00107 // 00108 // Revision 1.9 2002/01/08 16:02:49 kosta 00109 // dir structure for textures changed 00110 // 00111 // Revision 1.8 2002/01/07 07:33:02 kirsch 00112 // Removed Windows-style line endings 00113 // 00114 // Revision 1.7 2002/01/04 13:12:22 doellner 00115 // Redesign of canvas classes. Studio merged into Canvas, and removed. GLCanvas added, OpenGLCanvas removed. 00116 // 00117 // Revision 1.6 2001/11/13 16:36:31 kirsch 00118 // changed line feed to unix style (removed control-M) 00119 // 00120 // Revision 1.5 2001/08/29 12:09:10 kirsch 00121 // removed background color from canvas, use BackgroundGL instead 00122 // 00123 // Revision 1.4 2001/08/27 08:44:17 kersting 00124 // added OpenGLCanvas base class 00125 // 00126 // Revision 1.3 2001/08/21 09:39:04 kersting 00127 // added classname to enumeration 00128 // 00129 // Revision 1.2 2001/08/09 15:37:10 kirsch 00130 // Added shadows in OpenGL, created with alpha depthmaps. 00131 // Still experimental, some flaws 00132 // 00133 // Revision 1.1 2001/08/04 16:59:40 kosta 00134 // initial version 00135 // 00136 00137 #ifndef VRS_OPENGL_PBUFFERCANVASGL_H 00138 #define VRS_OPENGL_PBUFFERCANVASGL_H 00139 00140 #include <vrs/opengl/glcanvas.h> 00141 #include <vrs/opengl/cubemaptexturegl.h> 00142 #include <vrs/opengl/texture2dgl.h> 00143 00144 namespace VRS { 00145 00147 class VRS_CORE_API PBufferCanvasGL : public GLCanvas { 00148 public: 00149 PBufferCanvasGL( 00150 unsigned int width, unsigned int height, int properties = GLCanvas::RGBADS, 00151 GLCanvas* shareContextWith = NULL, 00152 bool useRenderToTexture = false, GLenum renderToTextureFormat = GL_RGBA, 00153 GLenum renderToTextureTarget = GL_TEXTURE_2D 00154 ); 00178 virtual ~PBufferCanvasGL(); 00179 00180 static bool isSupported(); 00183 static void disableSupport(); 00184 00185 // virtual void redisplay(Texture2DGL* texture); 00186 // /*!< Renders the scene graphs by an OpenGL engine. 00187 // After the evaluation, the given texture is updated. */ 00188 00189 Texture2DGL* getContentTexture(); 00195 Texture2DGL* newTexture(GLenum format = GL_ZERO, bool useMipmap = false); 00201 void setCubeMapRenderTarget(CubeMapTextureGL::Side); 00208 virtual void setSize(unsigned int width, unsigned int height); 00210 virtual unsigned int getWidth() const; 00212 virtual unsigned int getHeight() const; 00215 virtual int getProperties() const; 00218 virtual bool prepareRedisplay(); 00219 virtual void finishRedisplay(); 00220 00221 virtual void makeContextCurrent(); 00222 virtual void releaseContext(); 00223 00224 void updateTexture(Texture2DGL* texture = 0); 00229 void updateTextureArea(Texture2DGL*, const Area&); 00235 void updateTexture(CubeMapTextureGL* texture, CubeMapTextureGL::Side, bool finished); 00241 void releaseTexture(Texture2DGL* texture); 00246 void releaseTexture(CubeMapTextureGL* texture); 00251 VRS_TYPEINFO(PBufferCanvasGL, GLCanvas); 00252 00253 protected: 00254 friend class PBufferManagerGL; 00255 00256 private: 00257 bool useRenderToTexture_; 00258 GLenum renderToTextureFormat_; 00259 GLenum renderToTextureTarget_; 00260 SO<Texture2DGL> texture_; 00261 int properties_; 00262 unsigned int width_; 00263 unsigned int height_; 00264 00265 class Impl; 00266 Impl* impl_; 00267 00268 static bool disabled_; 00269 }; 00270 00271 } // namespace VRS 00272 00273 #endif // VRS_OPENGL_PBUFFERCANVASGL_H