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 #ifndef _SO_GL_GRAPHIC_DEVICE_H_ 00024 #define _SO_GL_GRAPHIC_DEVICE_H_ 00025 00026 #if defined(_WIN32) && !defined(__NUTC__) 00027 # include <windows.h> // for HDC def 00028 # ifdef _SO_QT_ 00029 # include <wingdi.h> 00030 # else 00031 # include <Inventor/Win/SoWinDef.h> 00032 # endif 00033 #else 00034 # include <Inventor/helpers/SbGlContextHelper.h> 00035 #endif 00036 #include <Inventor/sys/port.h> 00037 00038 #include <Inventor/components/SoGraphicDevice.h> 00039 #include <Inventor/components/SoGraphicConfig.h> 00040 #include <Inventor/components/SoGLGraphicConfig.h> 00041 #include <Inventor/components/SoGraphicConfigTemplate.h> 00042 #include <Inventor/components/SoGLGraphicConfigTemplate.h> 00043 00044 class SoGLGraphicDevicePeer; 00045 00069 class SoGLGraphicDevice : public SoGraphicDevice { 00070 00071 public: 00072 00074 enum DeviceType { 00076 WINDOW = 0, 00078 PBUFFER, 00080 BITMAP 00081 }; 00082 00083 #if defined(_WIN32) 00084 00087 SoGLGraphicDevice(HDC, DeviceType dt = SoGLGraphicDevice::WINDOW); 00088 #elif defined(__APPLE__) 00089 00092 SoGLGraphicDevice(SbGlContextHelper::Display, DeviceType dt = SoGLGraphicDevice::WINDOW); 00093 #else 00094 00097 SoGLGraphicDevice(SbGlContextHelper::Display , DeviceType dt = SoGLGraphicDevice::WINDOW); 00098 #endif 00099 00102 virtual ~SoGLGraphicDevice(); 00103 00104 #if defined(_WIN32) 00105 00108 SoGLGraphicDevice &operator()(HDC); 00109 #elif defined(__APPLE__) 00110 00113 SoGLGraphicDevice &operator()(SbGlContextHelper::Display); 00114 #else 00115 00118 SoGLGraphicDevice &operator()(SbGlContextHelper::Display); 00119 #endif 00120 00124 SoGraphicConfig *getBestGraphicConfig(const SoGraphicConfigTemplate &temp); 00125 00130 SoGraphicConfig *getDefaultGraphicConfig(); 00131 00159 SoGLGraphicConfigTemplate getGraphicConfigTemplate(SoGLGraphicConfig *graphicConfig); 00160 00165 size_t getNum(); 00166 00171 SoGraphicConfig *getGraphicConfig(size_t n); 00172 00177 size_t getNum(const SoGraphicConfigTemplate &temp); 00178 00183 SoGraphicConfig *getGraphicConfig(const SoGraphicConfigTemplate &temp, size_t n); 00184 00188 HDC getHDC(); 00189 00193 #if defined(__APPLE__) 00194 SbGlContextHelper::Display getDisplay(); 00195 #elif !defined(_WIN32) 00196 SbGlContextHelper::Display getDisplay(); 00197 #else 00198 UINT *getDisplay(); 00199 #endif 00200 00201 private: 00202 00203 size_t getNumSamplesAvailable(); 00207 int getNumSamples(size_t n); 00208 int findSampleIndex(int findInt); 00209 00210 private: 00211 00212 SoGLGraphicDevicePeer *m_devicePeer; 00213 void *m_sortedGraphicConfigs; 00214 SoGLGraphicConfigTemplate m_template; 00215 }; 00216 00217 #endif /* _SO_GL_GRAPHIC_DEVICE_H_ */ 00218 00219