34 RENDER = 0, DEPTH = 1, STENCIL = 2,
36 enum BufferDimension {
40 NONE = 0, COLOR_ONLY = 1, DEPTH_ONLY = 2, MULTI = 3,
43 IN_ORDER = 0, REVERSE = 1,
48 BufferType type = RENDER;
49 unsigned int renderbufferId = 0;
99 void AttachCubeBuffer(
int index,
int level = 0)
const;
101 void AttachFrameBuffer(
int target = GL_FRAMEBUFFER)
const;
103 void DetachFrameBuffer()
const;
105 void ResizeFrameBuffer(
int width,
int height);
107 void Exterminate()
override;
122 int GetWidth()
const;
124 int GetHeight()
const;
126 const ivec2& GetSize()
const {
130 BufferStatus GetBufferStatus()
const;
158 if (m_mainColorBuffer ==
nullptr)
return nullptr;
159 return m_mainColorBuffer->texture;
167 if (m_depthBuffer ==
nullptr)
return nullptr;
168 return m_depthBuffer->texture;
175 int GenerateAttachmentType(SFrameBuffer::BufferType type,
bool isIncreaseAttachment =
true)
const;
177 int GenerateInternalFormat(
int channel)
const;
179 int GenerateInternalType(
int channel)
const;
181 void ReleaseBufferObject(
const SFrameBuffer::BufferObject* bufferObject);
185 BufferDimension m_dimension = PLANE;
187 unsigned int m_fbo = 0;
188 std::vector<BufferObject*> m_buffers;
189 BufferObject* m_mainColorBuffer =
nullptr;
190 BufferObject* m_depthBuffer =
nullptr;
192 mutable BufferStatus m_bufferStatus = BufferStatus::NONE;
193 mutable unsigned short m_colorAttachmentSize = 0;
198 static BlitObject m_blitObject;