BsGLPixelFormat.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //__________________________ Banshee Project - A modern game development toolkit _________________________________//
  2. //_____________________________________ www.banshee-project.com __________________________________________________//
  3. //________________________ Copyright (c) 2014 Marko Pintera. All rights reserved. ________________________________//
  4. #pragma once
  5. #include "BsGLPrerequisites.h"
  6. #include "BsPixelUtil.h"
  7. namespace BansheeEngine
  8. {
  9. /**
  10. * @brief Converts pixel formats to OpenGL formats
  11. */
  12. class BS_RSGL_EXPORT GLPixelUtil
  13. {
  14. public:
  15. /**
  16. * @brief Returns matching OpenGL base pixel format type if one is found,
  17. * zero otherwise.
  18. */
  19. static GLenum getGLOriginFormat(PixelFormat mFormat);
  20. /**
  21. * @brief Returns OpenGL data type used in the provided format.
  22. */
  23. static GLenum getGLOriginDataType(PixelFormat mFormat);
  24. /**
  25. * @brief Returns matching OpenGL internal pixel format type if one is found,
  26. * zero otherwise. Optionally returns an SRGB format if "hwGamma" is specified
  27. * and such format exists.
  28. */
  29. static GLenum getGLInternalFormat(PixelFormat mFormat, bool hwGamma = false);
  30. /**
  31. * @brief Returns matching OpenGL internal pixel format type if one is found,
  32. * otherwise it returns the closest matching format. Optionally returns an
  33. * SRGB format if "hwGamma" is specified and such format exists.
  34. */
  35. static GLenum getClosestGLInternalFormat(PixelFormat mFormat, bool hwGamma = false);
  36. /**
  37. * @brief Returns an OpenGL type that should be used for creating a buffer for the specified
  38. * depth/stencil format.
  39. */
  40. static GLenum getDepthStencilTypeFromFormat(PixelFormat mFormat);
  41. /**
  42. * @brief Returns pixel format closest to the provided internal OpenGL format.
  43. */
  44. static PixelFormat getClosestEngineFormat(GLenum fmt);
  45. /**
  46. * @brief Returns closest supported format to the provided format.
  47. */
  48. static PixelFormat getClosestValidFormat(PixelFormat fmt);
  49. /**
  50. * @brief Converts an OpenGL internal format into base format.
  51. */
  52. static GLenum getBaseFormatFromCompressedInternalFormat(GLenum internalFormat);
  53. };
  54. };