CG-Project2
Loading...
Searching...
No Matches
FrameBuffer.hpp
1#pragma once
2
3#include "Buffer.hpp"
4
5#include "RenderBuffer.hpp"
6
7#include "../Texture/Texture.hpp"
8
9#include "../Core/Structs.hpp"
10
11namespace ogl {
12 class FrameBuffer : public Buffer {
13 public:
14 inline unsigned int getRenderBufferId() const { return this->m_rbo.getId(); }
15 void setRenderBuffer(const RBConfig &config);
16 void setRenderBuffer(const RenderBuffer &buffer);
17
18 inline unsigned int getColorTexture() const { return this->m_texture.getId(); }
19 void setColorTexture(const Texture &texture);
20
21 bool createFrameBuffer();
22 void rescaleFrameBuffer(const unsigned int &width, const unsigned int &height);
23
24 inline float getHeight() const { return this->m_config.height; }
25
26 virtual void onAttach() override;
27 virtual void onDetach() override;
28
29 virtual void bind() const override;
30 virtual void unbind() const override;
31
32 FrameBuffer() = delete;
33 FrameBuffer(const FBConfig &config) :
34 m_config(config) {}
35 ~FrameBuffer() override;
36
37 private:
38 FBConfig m_config{};
39
40 RenderBuffer m_rbo{};
41 Texture m_texture{};
42 };
43} // namespace ogl
Definition RenderBuffer.hpp:8
Definition Texture.hpp:8
Data structure to create an ogl::FrameBuffer using these parameters.
Definition Structs.hpp:52
Data structure to create an ogl::RenderBuffer using these parameters.
Definition Structs.hpp:38