CmGLSupport.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. #include "CmGLPBuffer.h"
  31. namespace CamelotEngine
  32. {
  33. class _OgreGLExport GLSupport
  34. {
  35. public:
  36. GLSupport() { }
  37. virtual ~GLSupport() { }
  38. /**
  39. * Add any special config values to the system.
  40. * Must have a "Full Screen" value that is a bool and a "Video Mode" value
  41. * that is a string in the form of wxh
  42. */
  43. virtual void addConfig() = 0;
  44. virtual void setConfigOption(const String &name, const String &value);
  45. /**
  46. * Make sure all the extra options are valid
  47. * @return string with error message
  48. */
  49. virtual String validateConfig() = 0;
  50. virtual ConfigOptionMap& getConfigOptions(void);
  51. virtual RenderWindow* createWindow(bool autoCreateWindow, GLRenderSystem* renderSystem, const String& windowTitle) = 0;
  52. /// @copydoc RenderSystem::_createRenderWindow
  53. virtual RenderWindow* newWindow(const String &name, unsigned int width, unsigned int height,
  54. bool fullScreen, const NameValuePairList *miscParams = 0) = 0;
  55. virtual bool supportsPBuffers();
  56. virtual GLPBuffer *createPBuffer(PixelComponentType format, size_t width, size_t height);
  57. /**
  58. * Start anything special
  59. */
  60. virtual void start() = 0;
  61. /**
  62. * Stop anything special
  63. */
  64. virtual void stop() = 0;
  65. /**
  66. * Get vendor information
  67. */
  68. const String& getGLVendor(void) const
  69. {
  70. return mVendor;
  71. }
  72. /**
  73. * Get version information
  74. */
  75. const String& getGLVersion(void) const
  76. {
  77. return mVersion;
  78. }
  79. /**
  80. * Compare GL version numbers
  81. */
  82. bool checkMinGLVersion(const String& v) const;
  83. /**
  84. * Check if an extension is available
  85. */
  86. virtual bool checkExtension(const String& ext) const;
  87. /**
  88. * Get the address of a function
  89. */
  90. virtual void* getProcAddress(const String& procname) = 0;
  91. /** Initialises GL extensions, must be done AFTER the GL context has been
  92. established.
  93. */
  94. virtual void initialiseExtensions();
  95. /// @copydoc RenderSystem::getDisplayMonitorCount
  96. virtual unsigned int getDisplayMonitorCount() const
  97. {
  98. return 1;
  99. }
  100. protected:
  101. // Stored options
  102. ConfigOptionMap mOptions;
  103. // This contains the complete list of supported extensions
  104. set<String>::type extensionList;
  105. private:
  106. String mVersion;
  107. String mVendor;
  108. }; // class GLSupport
  109. }; // namespace CamelotEngine
  110. #endif // OGRE_GLSUPPORT_H