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-2020 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 00042 class SoGLFormat 00043 { 00044 public: 00045 00049 SoGLFormat(); 00050 00055 SoGLFormat( const SbGlContextHelper::Display& display ); 00056 00060 SoGLFormat( const SoGLFormat& refFormat ); 00061 00065 virtual ~SoGLFormat(); 00066 00070 void setDoubleBuffersEnabled( const bool enabled ); 00071 00075 bool hasDoubleBuffers() const; 00076 00080 bool hasDepth() const; 00081 00085 void setDepthEnabled( const bool enable ); 00086 00090 void setDepthBits( const int bits ); 00091 00095 int getDepthBits() const; 00096 00100 bool hasAlpha() const; 00101 00105 void setAlphaEnabled( const bool enable ); 00106 00107 #if 1 SoDEPRECATED 00112 bool hasOverlay() const; 00113 SoDEPRECATED 00118 void setOverlayEnabled( const bool enabled ); 00119 SoDEPRECATED 00130 void setPlane( const int plane ); 00131 SoDEPRECATED 00136 int getPlane() const; 00137 #endif 00142 void setSampleBuffersEnabled( const bool enable ); 00143 00147 bool hasSampleBuffers() const; 00148 00152 void setSamplesCount( const int countSamples ); 00153 00157 int getSamplesCount() const; 00158 00162 void setStereoEnabled( const bool enable ); 00163 00167 bool hasStereo() const; 00168 00172 void setRgbEnabled( const bool enabled ); 00173 00177 bool hasRgb() const; 00178 00179 void setRedBits(int bits); 00180 00181 int getRedBits() const; 00182 00183 void setGreenBits(int bits); 00184 00185 int getGreenBits() const; 00186 00187 void setBlueBits(int bits); 00188 00189 int getBlueBits() const; 00190 00191 void setAlphaBits(int bits); 00192 00193 int getAlphaBits() const; 00194 00198 void setFloatColorBufferEnabled( const bool enable ); 00199 00203 bool hasFloatColorBuffer() const; 00204 00208 void setStencilBufferEnabled( const bool enabled ); 00209 00213 bool hasStencilBuffer() const; 00214 00218 void setStencilBufferBits( const int size ); 00219 00223 int getStencilBufferBits() const; 00224 00228 void setAccumBufferEnabled( const bool enabled ); 00229 00233 bool hasAccumBuffer() const; 00234 00238 void setAccumBufferBits( const int size ); 00239 00243 int getAccumBufferBits() const; 00244 00249 bool isAvailable() const; 00250 00256 SoGLFormat getNearest() const; 00257 00262 bool activate(); 00263 00267 const SbGlContextHelper::Display& getDisplay() const; 00268 00273 const SbGlContextHelper::VisualInfo& getVisualInfo() const; 00274 00289 void setCompositionRequired( const bool required ); 00290 00294 bool isCompositionRequired() const; 00295 00307 void setGDISupportRequired( const bool required ); 00308 00312 bool isGDISupportRequired() const; 00313 00317 void setAccelerationRequired(const bool enable); 00318 00322 bool isAccelerationRequired() const; 00323 00327 static SoGLFormat getDefaultFormat(); 00328 00329 #if 1 SoDEPRECATED 00334 static SoGLFormat getDefaultOverlayFormat(); 00335 #endif 00340 void setDisplay( const SbGlContextHelper::Display& display ); 00341 00349 void setVisualInfo( const SbGlContextHelper::VisualInfo& visualInfo ); 00350 00354 void setVisualInfoId( const int viId ); 00355 00359 int getVisualInfoId() const; 00360 00364 void setOpenglAttributes( const SbGlContextHelper::Display& display, int pfd, int* attributes, 00365 int* results ); 00366 00370 SoGLFormat& operator=( const SoGLFormat& ref ); 00371 00381 void setSoftwareRendererRequired(const bool enable); 00382 00386 bool isSoftwareRendererRequired() const; 00387 00388 private: 00389 00395 bool isGDIAvailable() const; 00396 00402 bool isRDPMode() const; 00403 00404 #if defined(_WIN32) 00405 00409 SoGLFormat( const SbGlContextHelper::Display& display, bool copyDC); 00410 00415 void setDisplay( const SbGlContextHelper::Display& display, bool copyDC); 00416 #endif //_WIN32 00417 00418 private: 00419 00423 void init(); 00424 00425 void resetDetectedData(); 00426 00427 private: 00428 00429 bool m_doubleBuffers; 00430 00431 bool m_depth; 00432 00433 int m_depthBits; 00434 00435 bool m_alpha; 00436 00437 bool m_overlay; 00438 00439 int m_plane; 00440 00441 bool m_sampleBuffers; 00442 00443 int m_samplesCount; 00444 00445 bool m_stereo; 00446 00447 bool m_rgb; 00448 00449 int m_redBits; 00450 00451 int m_greenBits; 00452 00453 int m_blueBits; 00454 00455 int m_alphaBits; 00456 00457 bool m_floatColorBuffer; 00458 00459 bool m_accumBuffer; 00460 00461 int m_accumBufferBits; 00462 00463 bool m_stencilBuffer; 00464 00465 int m_stencilBufferBits; 00466 00467 bool m_compositionRequired; 00468 00469 bool m_gidSupportRequired; 00470 00471 bool m_accelerationRequired; 00472 00473 bool m_softwareRendererRequired; 00474 00475 bool m_copyVisualInfoOnly; 00476 00477 bool m_copyDisplay; 00478 SbGlContextHelper::Display m_display; 00479 SbGlContextHelper::VisualInfo m_visualInfo; 00480 int m_visualInfoId; 00481 }; 00482 00483 #endif // SO_GLFORMAT_H 00484 00485 00486