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-2021 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 #if !defined( SO_GLFORMAT_H ) 00024 #define SO_GLFORMAT_H 00025 00026 00027 #include <Inventor/sys/port.h> 00028 #include <Inventor/SbBase.h> 00029 #include <Inventor/helpers/SbGlContextHelper.h> 00030 00032 namespace renderengine 00033 { 00034 namespace utils 00035 { 00036 namespace GL 00037 { 00038 class Format; 00039 } 00040 } 00041 } 00054 class SoGLFormat 00055 { 00056 public: 00057 00061 SoGLFormat(); 00062 00067 SoGLFormat( const SbGlContextHelper::Display& display ); 00068 00072 SoGLFormat( const SoGLFormat& refFormat ); 00073 00077 virtual ~SoGLFormat(); 00078 00082 void setDoubleBuffersEnabled( const bool enabled ); 00083 00087 bool hasDoubleBuffers() const; 00088 00092 bool hasDepth() const; 00093 00097 void setDepthEnabled( const bool enable ); 00098 00102 void setDepthBits( const int bits ); 00103 00107 int getDepthBits() const; 00108 00112 bool hasAlpha() const; 00113 00117 void setAlphaEnabled( const bool enable ); 00118 00122 void setSampleBuffersEnabled( const bool enable ); 00123 00127 bool hasSampleBuffers() const; 00128 00132 void setSamplesCount( const int countSamples ); 00133 00137 int getSamplesCount() const; 00138 00142 void setStereoEnabled( const bool enable ); 00143 00147 bool hasStereo() const; 00148 00152 void setRgbEnabled( const bool enabled ); 00153 00157 bool hasRgb() const; 00158 00159 void setRedBits(int bits); 00160 00161 int getRedBits() const; 00162 00163 void setGreenBits(int bits); 00164 00165 int getGreenBits() const; 00166 00167 void setBlueBits(int bits); 00168 00169 int getBlueBits() const; 00170 00171 void setAlphaBits(int bits); 00172 00173 int getAlphaBits() const; 00174 00178 void setFloatColorBufferEnabled( const bool enable ); 00179 00183 bool hasFloatColorBuffer() const; 00184 00188 void setStencilBufferEnabled( const bool enabled ); 00189 00193 bool hasStencilBuffer() const; 00194 00198 void setStencilBufferBits( const int size ); 00199 00203 int getStencilBufferBits() const; 00204 00208 void setAccumBufferEnabled( const bool enabled ); 00209 00213 bool hasAccumBuffer() const; 00214 00218 void setAccumBufferBits( const int size ); 00219 00223 int getAccumBufferBits() const; 00224 00229 bool isAvailable() const; 00230 00236 SoGLFormat getNearest() const; 00237 00242 bool activate(); 00243 00247 const SbGlContextHelper::Display& getDisplay() const; 00248 00253 const SbGlContextHelper::VisualInfo& getVisualInfo() const; 00254 00269 void setCompositionRequired( const bool required ); 00270 00274 bool isCompositionRequired() const; 00275 00287 void setGDISupportRequired( const bool required ); 00288 00292 bool isGDISupportRequired() const; 00293 00297 void setAccelerationRequired(const bool enable); 00298 00302 bool isAccelerationRequired() const; 00303 00307 static SoGLFormat getDefaultFormat(); 00308 00312 void setDisplay( const SbGlContextHelper::Display& display ); 00313 00321 void setVisualInfo( const SbGlContextHelper::VisualInfo& visualInfo ); 00322 00326 void setVisualInfoId( const int viId ); 00327 00331 int getVisualInfoId() const; 00332 00336 void setOpenglAttributes( const SbGlContextHelper::Display& display, int pfd, int* attributes, 00337 int* results ); 00338 00342 SoGLFormat& operator=( const SoGLFormat& ref ); 00343 00353 void setSoftwareRendererRequired(const bool enable); 00354 00358 bool isSoftwareRendererRequired() const; 00359 00360 private: 00361 00367 bool isGDIAvailable() const; 00368 00374 bool isRDPMode() const; 00375 00376 #if defined(_WIN32) 00377 00381 SoGLFormat( const SbGlContextHelper::Display& display, bool copyDC); 00382 00387 void setDisplay( const SbGlContextHelper::Display& display, bool copyDC); 00388 #endif //_WIN32 00389 00390 private: 00391 00395 void init(); 00396 00397 void resetDetectedData(); 00398 00399 private: 00400 renderengine::utils::GL::Format* m_format; 00401 }; 00402 00403 #endif // SO_GLFORMAT_H 00404 00405 00406