CmGLSupport.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. -----------------------------------------------------------------------------
  3. This source file is part of OGRE
  4. (Object-oriented Graphics Rendering Engine)
  5. For the latest info, see http://www.ogre3d.org/
  6. Copyright (c) 2000-2011 Torus Knot Software Ltd
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. THE SOFTWARE.
  22. -----------------------------------------------------------------------------
  23. */
  24. #ifndef OGRE_GLSUPPORT_H
  25. #define OGRE_GLSUPPORT_H
  26. #include "CmGLPrerequisites.h"
  27. #include "CmGLRenderSystem.h"
  28. #include "CmRenderWindow.h"
  29. #include "CmConfigOptionMap.h"
  30. namespace CamelotEngine
  31. {
  32. class CM_RSGL_EXPORT GLSupport
  33. {
  34. public:
  35. GLSupport() { }
  36. virtual ~GLSupport() { }
  37. /**
  38. * Add any special config values to the system.
  39. * Must have a "Full Screen" value that is a bool and a "Video Mode" value
  40. * that is a string in the form of wxh
  41. */
  42. virtual void addConfig() = 0;
  43. virtual void setConfigOption(const String &name, const String &value);
  44. /**
  45. * Make sure all the extra options are valid
  46. * @return string with error message
  47. */
  48. virtual String validateConfig() = 0;
  49. virtual ConfigOptionMap& getConfigOptions(void);
  50. virtual RenderWindow* newWindow(const String &name, unsigned int width, unsigned int height,
  51. bool fullScreen, const NameValuePairList *miscParams = 0) = 0;
  52. virtual bool supportsPBuffers();
  53. /**
  54. * Start anything special
  55. */
  56. virtual void start() = 0;
  57. /**
  58. * Stop anything special
  59. */
  60. virtual void stop() = 0;
  61. /**
  62. * Get vendor information
  63. */
  64. const String& getGLVendor(void) const
  65. {
  66. return mVendor;
  67. }
  68. /**
  69. * Get version information
  70. */
  71. const String& getGLVersion(void) const
  72. {
  73. return mVersion;
  74. }
  75. /**
  76. * Compare GL version numbers
  77. */
  78. bool checkMinGLVersion(const String& v) const;
  79. /**
  80. * Check if an extension is available
  81. */
  82. virtual bool checkExtension(const String& ext) const;
  83. /**
  84. * Get the address of a function
  85. */
  86. virtual void* getProcAddress(const String& procname) = 0;
  87. /** Initialises GL extensions, must be done AFTER the GL context has been
  88. established.
  89. */
  90. virtual void initialiseExtensions();
  91. /// @copydoc RenderSystem::getDisplayMonitorCount
  92. virtual unsigned int getDisplayMonitorCount() const
  93. {
  94. return 1;
  95. }
  96. protected:
  97. // Stored options
  98. ConfigOptionMap mOptions;
  99. // This contains the complete list of supported extensions
  100. set<String>::type extensionList;
  101. private:
  102. String mVersion;
  103. String mVendor;
  104. }; // class GLSupport
  105. }; // namespace CamelotEngine
  106. #endif // OGRE_GLSUPPORT_H