2
0

BsGLPixelFormat.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. /** @addtogroup GL
  9. * @{
  10. */
  11. /** Converts pixel formats to OpenGL formats */
  12. class BS_RSGL_EXPORT GLPixelUtil
  13. {
  14. public:
  15. /** Returns matching OpenGL base pixel format type if one is found, zero otherwise. */
  16. static GLenum getGLOriginFormat(PixelFormat mFormat);
  17. /** Returns OpenGL data type used in the provided format. */
  18. static GLenum getGLOriginDataType(PixelFormat mFormat);
  19. /**
  20. * Returns matching OpenGL internal pixel format type if one is found, zero otherwise. Optionally returns an SRGB
  21. * format if @p hwGamma is specified and such format exists.
  22. */
  23. static GLenum getGLInternalFormat(PixelFormat mFormat, bool hwGamma = false);
  24. /**
  25. * Returns matching OpenGL internal pixel format type if one is found, otherwise it returns the closest matching
  26. * format. Optionally returns an SRGB format if @p hwGamma is specified and such format exists.
  27. */
  28. static GLenum getClosestGLInternalFormat(PixelFormat mFormat, bool hwGamma = false);
  29. /** Returns an OpenGL type that should be used for creating a buffer for the specified depth/stencil format. */
  30. static GLenum getDepthStencilTypeFromFormat(PixelFormat mFormat);
  31. /** Returns pixel format closest to the provided internal OpenGL format. */
  32. static PixelFormat getClosestEngineFormat(GLenum fmt);
  33. /** Returns closest supported format to the provided format. */
  34. static PixelFormat getClosestValidFormat(PixelFormat fmt);
  35. /** Converts an OpenGL internal format into base format. */
  36. static GLenum getBaseFormatFromCompressedInternalFormat(GLenum internalFormat);
  37. };
  38. /** @} */
  39. };