00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2019 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 #if !defined SODEVICECONTEXT_H 00024 #define SODEVICECONTEXT_H 00025 00026 #include <Inventor/SbBase.h> 00027 #include <Inventor/misc/SoRefCounter.h> 00028 #include <Inventor/STL/set> 00029 #include <Inventor/STL/list> 00030 #include <Inventor/threads/SbThread.h> 00031 #include <Inventor/threads/SbThreadMutex.h> 00032 #include <Inventor/threads/SbThreadSpinlock.h> 00033 #include <Inventor/devices/SoDeviceContextSharedGroup.h> 00034 00035 #ifdef _WIN32 00036 #pragma warning(push) 00037 #pragma warning(disable:4251) 00038 #endif 00039 00040 class SbThreadMutex; 00041 class SoBaseContextCache; 00042 00061 class SoDeviceContext : public SoRefCounter 00062 { 00063 public: 00064 00068 SoDeviceContext(); 00069 00073 virtual void bind() = 0; 00074 00078 virtual void unbind() = 0; 00079 00086 virtual bool isCompatible( SoDeviceContext* ) const = 0; 00087 00091 virtual bool isCurrent() const =0; 00092 00094 void setSharable( bool sharable ); 00095 00097 bool isSharable() const; 00098 00100 virtual bool setSharedWith( SoDeviceContext* sourceCtx ); 00101 00103 virtual bool isSharedWith( const SoDeviceContext* context ) const; 00104 00106 virtual int getSharedId() const; 00107 00109 SoDeviceContextSharedGroup* getSharedGroup() const; 00110 00112 bool setSharedGroup(SoDeviceContextSharedGroup* sharedGroup); 00113 00119 virtual bool isValid() const; 00120 00121 private: 00122 00123 virtual SbString getInfos(); 00124 00125 private: 00129 virtual ~SoDeviceContext(); 00130 00132 void lockContext(); 00133 00135 void unlockContext(); 00136 00137 private: 00138 00140 SbThreadMutex m_mutex; 00141 00143 SoRef<SoDeviceContextSharedGroup> m_sharedGroup; 00144 00146 bool m_isSharable; 00147 00148 friend class SoGLContext_qtcontext_OIV_875_Stub; 00149 }; 00150 00151 #ifdef _WIN32 00152 #pragma warning(pop) 00153 #endif 00154 00155 #endif //#SODEVICECONTEXT_H 00156 00157