![]() |
Tulip
4.6.0
Better Visualization Through Research
|
00001 /* 00002 * 00003 * This file is part of Tulip (www.tulip-software.org) 00004 * 00005 * Authors: David Auber and the Tulip development Team 00006 * from LaBRI, University of Bordeaux 00007 * 00008 * Tulip is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation, either version 3 00011 * of the License, or (at your option) any later version. 00012 * 00013 * Tulip is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 * See the GNU General Public License for more details. 00017 * 00018 */ 00019 ///@cond DOXYGEN_HIDDEN 00020 00021 #ifndef Tulip_OPENGLCONFIGMANAGER_H 00022 #define Tulip_OPENGLCONFIGMANAGER_H 00023 00024 #include <tulip/tulipconf.h> 00025 00026 #include <map> 00027 #include <string> 00028 00029 #define BUFFER_OFFSET(bytes) ((GLubyte*) NULL + (bytes)) 00030 00031 namespace tlp { 00032 00033 /** \brief Singleton used to manage OpenGl configuration 00034 * 00035 * Singleton used to manage OpenGl configuration 00036 */ 00037 class TLP_GL_SCOPE OpenGlConfigManager { 00038 00039 public: 00040 00041 /** 00042 * Return the current instance. If instance doesn't exist, create it. 00043 */ 00044 static OpenGlConfigManager &getInst(); 00045 00046 /** 00047 * Returns the OpenGL version number supported by the host system. 00048 */ 00049 double getOpenGLVersion(); 00050 00051 /** 00052 * Return the vendor name of the OpenGL driver installed on the host system. 00053 */ 00054 std::string getOpenGLVendor(); 00055 00056 void initExtensions(); 00057 00058 /** 00059 * Checks if an OpenGL extension is supported by the driver installed on the host system. 00060 * \param extensionName the name of the OpenGL extension to check in the form "GL_.*" (for instance "GL_ARB_vertex_buffer_object") 00061 */ 00062 bool isExtensionSupported(const std::string &extensionName); 00063 00064 /** 00065 * Returns if vertex buffer objects can be used on the host system. 00066 */ 00067 bool hasVertexBufferObject(); 00068 00069 /** 00070 * Enables / disables anti-aliasing rendering. 00071 */ 00072 void setAntiAliasing(const bool antialiasing) { 00073 antialiased = antialiasing; 00074 } 00075 00076 /** 00077 * Returns the anti-aliasing state 00078 */ 00079 bool antiAliasing() const { 00080 return antialiased; 00081 } 00082 00083 /** 00084 * Activates anti-aliasing 00085 * This method has no effect if anti-aliasing has been disabled by a call to setAntiAliasing(false). 00086 */ 00087 void activateAntiAliasing(); 00088 00089 /** 00090 * Desactivates anti-aliasing 00091 * This method has no effect if anti-aliasing has been disabled by a call to setAntiAliasing(false). 00092 */ 00093 void desactivateAntiAliasing(); 00094 00095 /** 00096 * Activates the anti-aliasing of lines and points primitives. 00097 * This method has no effect if anti-aliasing has been disabled by a call to setAntiAliasing(false). 00098 */ 00099 _DEPRECATED void activateLineAndPointAntiAliasing(); 00100 00101 /** 00102 * Desactivates the anti-aliasing of lines and points primitives. 00103 * This method has no effect if anti-aliasing has been disabled by a call to setAntiAliasing(false). 00104 */ 00105 _DEPRECATED void desactivateLineAndPointAntiAliasing(); 00106 00107 /** 00108 * Activates the anti-aliasing of polygons primitives. 00109 * This method has no effect if anti-aliasing has been disabled by a call to setAntiAliasing(false). 00110 */ 00111 _DEPRECATED void activatePolygonAntiAliasing(); 00112 /** 00113 * Desactivates the anti-aliasing of polygons primitives. 00114 * This method has no effect if anti-aliasing has been disabled by a call to setAntiAliasing(false). 00115 */ 00116 _DEPRECATED void desactivatePolygonAntiAliasing(); 00117 00118 private: 00119 00120 /** 00121 * Private constructor for singleton 00122 */ 00123 OpenGlConfigManager(); 00124 00125 static OpenGlConfigManager* inst; 00126 00127 bool glewIsInit; 00128 bool driversAreChecked; 00129 bool antialiased; 00130 00131 std::map<std::string, bool> checkedExtensions; 00132 00133 }; 00134 00135 } 00136 00137 #endif 00138 ///@endcond