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-2017 BY FEI S.A.S, *** 00017 *** MERIGNAC, 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 00031 namespace renderengine 00032 { 00033 namespace utils 00034 { 00035 namespace GL 00036 { 00037 class Format; 00038 } 00039 } 00040 } 00041 00052 class SoGLFormat 00053 { 00054 public: 00055 00059 SoGLFormat(); 00060 00065 SoGLFormat( const SbGlContextHelper::Display& display ); 00066 00070 SoGLFormat( const SoGLFormat& refFormat ); 00071 00075 virtual ~SoGLFormat(); 00076 00080 void setDoubleBuffersEnabled( const bool enabled ); 00081 00085 bool hasDoubleBuffers() const; 00086 00090 bool hasDepth() const; 00091 00095 void setDepthEnabled( const bool enable ); 00096 00100 void setDepthBits( const int bits ); 00101 00105 int getDepthBits() const; 00106 00110 bool hasAlpha() const; 00111 00115 void setAlphaEnabled( const bool enable ); 00116 00120 void setSampleBuffersEnabled( const bool enable ); 00121 00125 bool hasSampleBuffers() const; 00126 00130 void setSamplesCount( const int countSamples ); 00131 00135 int getSamplesCount() const; 00136 00140 void setStereoEnabled( const bool enable ); 00141 00145 bool hasStereo() const; 00146 00150 void setRgbEnabled( const bool enabled ); 00151 00155 bool hasRgb() const; 00156 00157 void setRedBits(int bits); 00158 00159 int getRedBits() const; 00160 00161 void setGreenBits(int bits); 00162 00163 int getGreenBits() const; 00164 00165 void setBlueBits(int bits); 00166 00167 int getBlueBits() const; 00168 00169 void setAlphaBits(int bits); 00170 00171 int getAlphaBits() const; 00172 00176 void setFloatColorBufferEnabled( const bool enable ); 00177 00181 bool hasFloatColorBuffer() const; 00182 00186 void setStencilBufferEnabled( const bool enabled ); 00187 00191 bool hasStencilBuffer() const; 00192 00196 void setStencilBufferBits( const int size ); 00197 00201 int getStencilBufferBits() const; 00202 00206 void setAccumBufferEnabled( const bool enabled ); 00207 00211 bool hasAccumBuffer() const; 00212 00216 void setAccumBufferBits( const int size ); 00217 00221 int getAccumBufferBits() const; 00222 00227 bool isAvailable() const; 00228 00234 SoGLFormat getNearest() const; 00235 00240 bool activate(); 00241 00245 const SbGlContextHelper::Display& getDisplay() const; 00246 00251 const SbGlContextHelper::VisualInfo& getVisualInfo() const; 00252 00267 void setCompositionRequired( const bool required ); 00268 00272 bool isCompositionRequired() const; 00273 00285 void setGDISupportRequired( const bool required ); 00286 00290 bool isGDISupportRequired() const; 00291 00295 void setAccelerationRequired(const bool enable); 00296 00300 bool isAccelerationRequired() const; 00301 00305 static SoGLFormat getDefaultFormat(); 00306 00310 void setDisplay( const SbGlContextHelper::Display& display ); 00311 00319 void setVisualInfo( const SbGlContextHelper::VisualInfo& visualInfo ); 00320 00324 void setVisualInfoId( const int viId ); 00325 00329 int getVisualInfoId() const; 00330 00334 void setOpenglAttributes( const SbGlContextHelper::Display& display, int pfd, int* attributes, 00335 int* results ); 00336 00340 SoGLFormat& operator=( const SoGLFormat& ref ); 00341 00351 void setSoftwareRendererRequired(const bool enable); 00352 00356 bool isSoftwareRendererRequired() const; 00357 00358 private: 00359 00365 bool isGDIAvailable() const; 00366 00372 bool isRDPMode() const; 00373 00374 #if defined(_WIN32) 00375 00379 SoGLFormat( const SbGlContextHelper::Display& display, bool copyDC); 00380 00385 void setDisplay( const SbGlContextHelper::Display& display, bool copyDC); 00386 #endif //_WIN32 00387 00388 private: 00389 00393 void init(); 00394 00395 void resetDetectedData(); 00396 00397 private: 00398 renderengine::utils::GL::Format* m_format; 00399 }; 00400 00401 #endif // SO_GLFORMAT_H 00402 00403 00404