Framebuffer.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. {
  8. public:
  9. static const u32 POSITION = 1;
  10. static const u32 NORMAL = 2;
  11. static const u32 COLOR = 4;
  12. static const u32 RED = 8;
  13. static const u32 DEPTH24_STENCIL8 = 16;
  14. Framebuffer(u32 width, u32 height, u32 mode);
  15. ~Framebuffer();
  16. bool isValid() const;
  17. void bind() const;
  18. void resize(u32 width, u32 height) const;
  19. void bindPositionTexture(u32 textureUnit) const;
  20. void bindNormalTexture(u32 textureUnit) const;
  21. void bindColorTexture(u32 textureUnit) const;
  22. void bindRedTexture(u32 textureUnit) const;
  23. void bindDepthTexture(u32 textureUnit) const;
  24. private:
  25. Framebuffer(const Framebuffer& other) = delete;
  26. Framebuffer(Framebuffer&& other) = delete;
  27. Framebuffer& operator=(const Framebuffer& other) = delete;
  28. Framebuffer& operator=(Framebuffer&& other) = delete;
  29. u32 mode;
  30. std::array<GLuint, 5> textures;
  31. GLuint buffer;
  32. bool valid;
  33. };
  34. #endif