Framebuffer.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef FRAMEBUFFER_H
  2. #define FRAMEBUFFER_H
  3. #include <GL/glew.h>
  4. #include <array>
  5. #include "common/utils/Types.h"
  6. class Framebuffer final {
  7. public:
  8. static const u32 POSITION = 1;
  9. static const u32 NORMAL = 2;
  10. static const u32 COLOR = 4;
  11. static const u32 RED = 8;
  12. static const u32 DEPTH24_STENCIL8 = 16;
  13. Framebuffer(u32 width, u32 height, u32 mode, int textureCompareFunc);
  14. ~Framebuffer();
  15. bool isValid() const;
  16. void bind() const;
  17. void resize(u32 width, u32 height) const;
  18. void bindPositionTexture(u32 textureUnit) const;
  19. void bindNormalTexture(u32 textureUnit) const;
  20. void bindColorTexture(u32 textureUnit) const;
  21. void bindRedTexture(u32 textureUnit) const;
  22. void bindDepthTexture(u32 textureUnit) const;
  23. private:
  24. Framebuffer(const Framebuffer& other) = delete;
  25. Framebuffer(Framebuffer&& other) = delete;
  26. Framebuffer& operator=(const Framebuffer& other) = delete;
  27. Framebuffer& operator=(Framebuffer&& other) = delete;
  28. u32 mode;
  29. std::array<GLuint, 5> textures;
  30. GLuint buffer;
  31. bool valid;
  32. };
  33. #endif