SGCT master (487fac4)
Simple Graphics Cluster Toolkit
Loading...
Searching...
No Matches
offscreenbuffer.h
Go to the documentation of this file.
1/*****************************************************************************************
2 * SGCT *
3 * Simple Graphics Cluster Toolkit *
4 * *
5 * Copyright (c) 2012-2026 *
6 * For conditions of distribution and use, see copyright notice in LICENSE.md *
7 ****************************************************************************************/
8
9#ifndef __SGCT__OFFSCREENBUFFER__H__
10#define __SGCT__OFFSCREENBUFFER__H__
11
12#include <sgct/sgctexports.h>
13
14#include <sgct/math.h>
15
16namespace sgct {
17
21class SGCT_EXPORT OffScreenBuffer {
22public:
23 static void unbind();
24
25 explicit OffScreenBuffer(unsigned int internalFormat);
27
28 void createFBO(int width, int height, int samples = 1);
29 void resizeFBO(int width, int height, int samples = 1);
30
35 void attachColorTexture(unsigned int texId, unsigned int attachment) const;
36 void attachDepthTexture(unsigned int texId) const;
37
43 void attachCubeMapTexture(unsigned int texId, unsigned int face,
44 unsigned int attachment) const;
45 void attachCubeMapDepthTexture(unsigned int texId, unsigned int face) const;
46
50 void bind() const;
51
59 void bind(bool isMultisampled, int n, const unsigned int* bufs) const;
60 void bindBlit() const;
61 void blit() const;
62 bool isMultiSampled() const;
63
64private:
65 unsigned int _frameBuffer = 0;
66 unsigned int _multiSampledFrameBuffer = 0;
67 unsigned int _colorBuffer = 0;
68 unsigned int _normalBuffer = 0;
69 unsigned int _positionBuffer = 0;
70 unsigned int _depthBuffer = 0;
71 const unsigned int _internalColorFormat = 0x8058; // GL_RGBA8;
72
73 ivec2 _size = ivec2{ -1, -1 };
74 bool _isMultiSampled = false;
75};
76
77} // namespace sgct
78
79#endif // __SGCT__OFFSCREENBUFFER__H__
static void unbind()
void createFBO(int width, int height, int samples=1)
void attachColorTexture(unsigned int texId, unsigned int attachment) const
bool isMultiSampled() const
void bind(bool isMultisampled, int n, const unsigned int *bufs) const
Bind framebuffer.
void attachCubeMapDepthTexture(unsigned int texId, unsigned int face) const
void attachCubeMapTexture(unsigned int texId, unsigned int face, unsigned int attachment) const
void resizeFBO(int width, int height, int samples=1)
OffScreenBuffer(unsigned int internalFormat)
void bind() const
Bind framebuffer, auto-set multisampling and draw buffers.
void bindBlit() const
void attachDepthTexture(unsigned int texId) const
Definition actions.h:16
Definition math.h:17