| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /****************************************************************************** 00002 * VRS - The Virtual Rendering System 00003 * Copyright (C) 2003 Computer Graphics Systems Group at the 00004 * Hasso-Plattner-Institute (HPI), Potsdam, Germany. 00005 * 00006 * This library is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2.1 of the License, or (at 00009 * your option) any later version. This library is distributed in the hope 00010 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 00011 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Lesser General Public License for more details. You should have received 00013 * a copy of the GNU Lesser+ General Public License along with this library; if 00014 * not, write to the FreeSoftware Foundation, Inc., 59 Temple Place, Suite 330, 00015 * Boston, MA, 02111-1307, USA. 00016 ******************************************************************************/ 00017 00018 // $Id: sharedcontextgl.h 6014 2007-08-09 07:51:16Z Konstantin_Baumann $ 00019 // $Date: 2007-08-09 09:51:16 +0200 (Thu, 09 Aug 2007) $ 00020 // $Revision: 6014 $ 00021 // $State$ 00022 // $Author: Konstantin_Baumann $ 00023 // 00024 // $Log$ 00025 // Revision 1.31 2005/07/19 10:34:17 nienhaus 00026 // framebuffer object changes 00027 // 00028 // Revision 1.30 2005/01/03 01:43:09 klimetschek 00029 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00030 // - removed vrs.vcproj 00031 // minor things: 00032 // - added all glutexamples to vrs4glut.sln 00033 // - fixed some problems in glutexamples 00034 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00035 // 00036 // Revision 1.29 2004/11/03 14:45:06 saar 00037 // Class comment changed (Doxygen style) 00038 // 00039 // Revision 1.28 2004/03/12 16:28:40 baumann 00040 // macros VRS_NAMESPACE_BEGIN/_END expanded and removed 00041 // 00042 // Revision 1.27 2004/03/07 14:42:00 baumann 00043 // code simplified 00044 // 00045 // Revision 1.26 2004/01/19 11:43:58 baumann 00046 // serialization mechanism improved 00047 // 00048 // Revision 1.25 2003/11/07 14:19:25 kirsch 00049 // removed leading underscore from include guards 00050 // 00051 // Revision 1.24 2003/10/22 12:42:41 kirsch 00052 // added support for generic OpenGL 2.0 objects 00053 // 00054 // Revision 1.23 2003/06/06 16:30:09 kirsch 00055 // - added ShaderProgramGL as common base class for ARB vertex and fragment programs 00056 // - added FragmenProgramGL 00057 // - added ShaderProgramPainterGL (painter for VertexProgramGL and FragmentProgramGL) 00058 // - removed VertexProgramPainterGL 00059 // - changed interface of ARB and NVidia program IDs in shared context 00060 // 00061 // Revision 1.22 2003/05/28 14:14:43 kirsch 00062 // added support for creating ARB vertex program IDs 00063 // 00064 // Revision 1.21 2003/05/08 13:36:28 kirsch 00065 // get vertex program ids from shared context 00066 // 00067 // Revision 1.20 2003/04/02 06:56:14 baumann 00068 // deletion of buffer object in cleanup code added 00069 // 00070 // Revision 1.19 2003/03/11 08:27:12 baumann 00071 // removed client data member (it was the same as of SharedObj) 00072 // 00073 // Revision 1.18 2002/10/29 10:32:52 baumann 00074 // macros VRS_CLASSNAME_* and VRS_IMPL_TYPEINFO_* removed 00075 // 00076 // Revision 1.17 2002/10/28 12:37:08 kirsch 00077 // moved creation of pbuffermanager to shared context 00078 // removed engine and context attribute from pbuffermanager 00079 // instead the engine is given as argument 00080 // 00081 // Revision 1.16 2002/10/11 12:32:16 baumann 00082 // changes for SharedObj::registerCallback() 00083 // 00084 // Revision 1.15 2002/07/02 15:23:48 baumann 00085 // non-persistent containers now have the prefix NonPersistent, e.g. NonPersistentArray<T> 00086 // persistent containers now have no prefix, e.g. Array<T> 00087 // 00088 // Revision 1.14 2002/06/24 14:03:38 baumann 00089 // changed List<T> to Array<T> 00090 // 00091 // Revision 1.13 2002/03/04 12:00:26 kersting 00092 // directory structure changes 00093 // 00094 // Revision 1.12 2002/03/03 21:44:26 kosta 00095 // VRS_TYPEINFO-macro rewritten 00096 // 00097 // Revision 1.11 2002/03/03 16:37:59 kosta 00098 // changed VRS-typeinfo to C++-typeid 00099 // 00100 // Revision 1.10 2002/02/19 10:34:19 kosta 00101 // undone all changes since 2002-02-15 00102 // 00103 // Revision 1.7 2002/02/05 07:48:26 kosta 00104 // new persistency macros: 00105 // VRS_SERIALIZABLE(CLASS_NAME); 00106 // VRS_SERIALIZABLE_ABSTRACT_CLASS(CLASS_NAME); 00107 // VRS_SERIALIZABLE_NO_SO_CLASS(CLASS_NAME) 00108 // 00109 // Revision 1.6 2002/02/04 11:54:37 kosta 00110 // persistency rewritten (for better namespace support) 00111 // 00112 // Revision 1.5 2002/01/15 16:25:55 kosta 00113 // macros rewritten for a better namespace support 00114 // 00115 // Revision 1.4 2001/11/13 16:36:31 kirsch 00116 // changed line feed to unix style (removed control-M) 00117 // 00118 // Revision 1.3 2001/07/25 21:27:46 kosta 00119 // new texture mechanism implemented 00120 // 00121 // Revision 1.2 2001/07/17 20:24:29 kosta 00122 // complicated support for pre OpenGL 1.1 versions removed 00123 // 00124 // Revision 1.1.1.1 2001/06/08 08:09:21 kirsch 00125 // imported alpha-version by olli 00126 // 00127 00128 00129 #ifndef VRS_OPENGL_SHAREDCONTEXTGL_H 00130 #define VRS_OPENGL_SHAREDCONTEXTGL_H 00131 00132 #include <vrs/container/dictionary.h> 00133 #include <vrs/opengl/openglconfig.h> 00134 #include <vector> 00135 00136 namespace VRS { 00137 00138 class PBufferManagerGL; 00139 00141 class VRS_CORE_API SharedContextGL : public SharedObj { 00142 public: 00143 SharedContextGL(); 00144 virtual ~SharedContextGL(); 00151 PBufferManagerGL* pbufferManager() const; 00156 GLuint getDisplayList(SharedObj* obj); 00157 GLuint newDisplayList(SharedObj* obj); 00161 void invalidateDisplayList(SharedObj* obj); 00166 GLuint getTextureObject(SharedObj* obj, GLenum target); 00167 GLuint newTextureObject(SharedObj* obj, GLenum target); 00171 void invalidateTextureObject(SharedObj* obj); 00176 GLuint getFrameBufferObject(SharedObj* obj, GLenum target); 00177 GLuint newFrameBufferObject(SharedObj* obj, GLenum target); 00181 void invalidateFrameBufferObject(SharedObj* obj); 00186 GLuint getRenderBuffer(SharedObj* obj, GLenum target); 00187 GLuint newRenderBuffer(SharedObj* obj, GLenum target); 00191 void invalidateRenderBuffer(SharedObj* obj); 00196 GLuint getNVProgram(SharedObj* obj); 00197 GLuint newNVProgram(SharedObj* obj); 00202 void invalidateNVProgram(SharedObj* obj); 00207 GLuint getARBProgram(SharedObj* obj); 00208 GLuint newARBProgram(SharedObj* obj); 00213 void invalidateARBProgram(SharedObj* obj); 00218 GLhandleARB getGenericObject(SharedObj* obj); 00219 GLhandleARB newGenericObject(SharedObj* obj, GLhandleARB handle); 00225 void invalidateGenericObject(SharedObj* obj); 00229 void invalidateBufferObject(GLuint id); 00234 void cleanUp(); 00240 VRS_TYPEINFO(SharedContextGL, SharedObj); 00241 00242 public: 00243 struct CallbackData { 00244 union { 00245 GLuint ident; 00246 GLhandleARB handle; 00247 }; 00248 GLenum target; 00249 }; 00250 00251 private: 00252 SO<PBufferManagerGL> pbufferMgr_; 00253 00254 std::vector<GLuint> invalidDisplayLists_; 00255 std::vector<GLuint> invalidTextureObjects_; 00256 std::vector<GLuint> invalidFBOs_; 00257 std::vector<GLuint> invalidRenderBuffers_; 00258 std::vector<GLuint> invalidNVPrograms_; 00259 std::vector<GLuint> invalidARBPrograms_; 00260 std::vector<GLhandleARB> invalidGenericObjects_; 00261 std::vector<GLuint> invalidBufferObjects_; 00262 00263 SO<NonPersistentDictionary<SharedObj*, CallbackData> > displayListTable_; 00264 SO<NonPersistentDictionary<SharedObj*, CallbackData> > textureObjectTable_; 00265 SO<NonPersistentDictionary<SharedObj*, CallbackData> > fBOTable_; 00266 SO<NonPersistentDictionary<SharedObj*, CallbackData> > renderBufferTable_; 00267 SO<NonPersistentDictionary<SharedObj*, CallbackData> > NVProgramTable_; 00268 SO<NonPersistentDictionary<SharedObj*, CallbackData> > ARBProgramTable_; 00269 SO<NonPersistentDictionary<SharedObj*, CallbackData> > genericObjectTable_; 00270 00271 SO<Callback1<SharedObj*> > displayListCallback_; 00272 SO<Callback1<SharedObj*> > textureCallback_; 00273 SO<Callback1<SharedObj*> > fBOCallback_; 00274 SO<Callback1<SharedObj*> > renderBufferCallback_; 00275 SO<Callback1<SharedObj*> > NVProgramCallback_; 00276 SO<Callback1<SharedObj*> > ARBProgramCallback_; 00277 SO<Callback1<SharedObj*> > genericObjectCallback_; 00278 }; 00279 00280 } // namespace VRS 00281 00282 #endif // VRS_OPENGL_SharedContextGL_H