/opengles/src/Config.h

http://ftk.googlecode.com/ · C Header · 131 lines · 79 code · 16 blank · 36 comment · 0 complexity · 1fb5219424bcd1cf2711dcae5648a940 MD5 · raw file

  1. #ifndef EGL_CONFIG_H
  2. #define EGL_CONFIG_H 1
  3. // ==========================================================================
  4. //
  5. // Config.h Configuration Management Class
  6. // for 3D Rendering Library
  7. //
  8. // --------------------------------------------------------------------------
  9. //
  10. // 08-14-2003 Hans-Martin Will initial version
  11. //
  12. // --------------------------------------------------------------------------
  13. //
  14. // Copyright (c) 2004, Hans-Martin Will. All rights reserved.
  15. //
  16. // Redistribution and use in source and binary forms, with or without
  17. // modification, are permitted provided that the following conditions are
  18. // met:
  19. //
  20. // * Redistributions of source code must retain the above copyright
  21. // notice, this list of conditions and the following disclaimer.
  22. // * Redistributions in binary form must reproduce the above copyright
  23. // notice, this list of conditions and the following disclaimer in the
  24. // documentation and/or other materials provided with the distribution.
  25. //
  26. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  27. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29. // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  30. // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
  31. // OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  32. // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  33. // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  34. // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  35. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  36. // THE POSSIBILITY OF SUCH DAMAGE.
  37. //
  38. // ==========================================================================
  39. #include "OGLES.h"
  40. #include "GLES/egl.h"
  41. namespace EGL {
  42. class Context;
  43. class Config {
  44. #if defined(EGL_ON_LINUX)
  45. friend class Context;
  46. #else
  47. friend Context;
  48. #endif
  49. public:
  50. Config(
  51. EGLint bufferSize,
  52. EGLint redSize,
  53. EGLint greenSize,
  54. EGLint blueSize,
  55. EGLint alphaSize,
  56. EGLint configCaveat,
  57. EGLint configID,
  58. EGLint depthSize,
  59. EGLint level,
  60. EGLint maxPBufferWidth,
  61. EGLint maxPBufferHeight,
  62. EGLint mxPBufferPixels,
  63. EGLint nativeRenderable,
  64. EGLint nativeVisualID,
  65. EGLint nativeVisualType,
  66. EGLint sampleBuffers,
  67. EGLint samples,
  68. EGLint stencilSize,
  69. EGLint surfaceType,
  70. EGLint transparentType,
  71. EGLint transparentRedValue,
  72. EGLint transparentGreenValue,
  73. EGLint transparentBlueValue,
  74. EGLint width,
  75. EGLint height
  76. );
  77. OGLES_API Config() { }
  78. Config (const Config &other, const EGLint * attribList = 0, const EGLint * validAttributes = 0);
  79. Config & operator=(const Config & other);
  80. EGLint GetConfigAttrib(EGLint attribute) const;
  81. void SetConfigAttrib(EGLint attribute, EGLint value);
  82. static EGLBoolean GetConfigs(EGLConfig * result, EGLint configSize, EGLint * numConfig);
  83. static EGLBoolean ChooseConfig(const EGLint * attribList, EGLConfig * result, EGLint configSize, EGLint * numConfig);
  84. private:
  85. bool Matches(EGLint attribList);
  86. static bool IsValidAttribute(const EGLint * validAttributes, EGLint attribute);
  87. private:
  88. EGLint m_BufferSize;
  89. EGLint m_RedSize;
  90. EGLint m_GreenSize;
  91. EGLint m_BlueSize;
  92. EGLint m_AlphaSize;
  93. EGLint m_ConfigCaveat;
  94. EGLint m_ConfigID;
  95. EGLint m_DepthSize;
  96. EGLint m_Level;
  97. EGLint m_MaxPBufferWidth;
  98. EGLint m_MaxPBufferHeight;
  99. EGLint m_MaxPBufferPixels;
  100. EGLint m_NativeRenderable;
  101. EGLint m_NativeVisualID;
  102. EGLint m_NativeVisualType;
  103. EGLint m_SampleBuffers;
  104. EGLint m_Samples;
  105. EGLint m_StencilSize;
  106. EGLint m_SurfaceType;
  107. EGLint m_TransparentType;
  108. EGLint m_TransparentRedValue;
  109. EGLint m_TransparentGreenValue;
  110. EGLint m_TransparentBlueValue;
  111. EGLint m_Width;
  112. EGLint m_Height;
  113. };
  114. }
  115. #endif // ndef EGL_CONFIG_H