BsGLPixelFormat.h 2.1 KB

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