CGVIS Utils
Loading...
Searching...
No Matches
GLFramebuffer.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "GLEnv.h"
6
7#include "GLTexture2D.h"
8#include "GLTexture3D.h"
9#include "GLDepthBuffer.h"
10#include "GLDepthTexture.h"
11
28public:
33
38 const GLuint getId() const;
39
40 // ===== Bind helpers: depth texture + color 2D textures =====
42 void bind(const GLDepthTexture& d);
44 void bind(const GLTexture2D& t, const GLDepthTexture& d);
46 void bind(const GLTexture2D& t0, const GLTexture2D& t1, const GLDepthTexture& d);
48 void bind(const GLTexture2D& t0, const GLTexture2D& t1, const GLTexture2D& t2, const GLDepthTexture& d);
50 void bind(const GLTexture2D& t0, const GLTexture2D& t1, const GLTexture2D& t2, const GLTexture2D& t3, const GLDepthTexture& d);
51
52 // ===== Bind helpers: depth renderbuffer + color 2D textures =====
54 void bind(const GLTexture2D& t, const GLDepthBuffer& d);
56 void bind(const GLTexture2D& t0, const GLTexture2D& t1, const GLDepthBuffer& d);
58 void bind(const GLTexture2D& t0, const GLTexture2D& t1, const GLTexture2D& t2, const GLDepthBuffer& d);
60 void bind(const GLTexture2D& t0, const GLTexture2D& t1, const GLTexture2D& t2, const GLTexture2D& t3, const GLDepthBuffer& d);
61
62 // ===== Bind helpers: color-only 2D textures (no depth) =====
64 void bind(const GLTexture2D& t);
66 void bind(const GLTexture2D& t0, const GLTexture2D& t1);
68 void bind(const GLTexture2D& t0, const GLTexture2D& t1, const GLTexture2D& t2);
70 void bind(const GLTexture2D& t0, const GLTexture2D& t1, const GLTexture2D& t2, const GLTexture2D& t3);
71
72 // ===== Bind helpers: depth renderbuffer + 3D texture slices =====
74 void bind(const GLTexture3D& t, size_t slice, const GLDepthBuffer& d);
76 void bind(const GLTexture3D& t0, size_t slice0, const GLTexture3D& t1, size_t slice1, const GLDepthBuffer& d);
78 void bind(const GLTexture3D& t0, size_t slice0, const GLTexture3D& t1, size_t slice1, const GLTexture3D& t2, size_t slice2,
79 const GLDepthBuffer& d);
81 void bind(const GLTexture3D& t0, size_t slice0, const GLTexture3D& t1, size_t slice1, const GLTexture3D& t2, size_t slice2,
82 const GLTexture3D& t3, size_t slice3, const GLDepthBuffer& d);
83
84 // ===== Bind helpers: color-only 3D texture slices (no depth) =====
86 void bind(const GLTexture3D& t, size_t slice);
88 void bind(const GLTexture3D& t0, size_t slice0, const GLTexture3D& t1, size_t slice1);
90 void bind(const GLTexture3D& t0, size_t slice0, const GLTexture3D& t1, size_t slice1, const GLTexture3D& t2, size_t slice2);
92 void bind(const GLTexture3D& t0, size_t slice0, const GLTexture3D& t1, size_t slice1, const GLTexture3D& t2, size_t slice2,
93 const GLTexture3D& t3, size_t slice3);
94
96 void unbind2D();
98 void unbind3D();
99
104 bool checkBinding() const;
105
106private:
107 GLuint id;
108
115 void setBuffers(size_t count, size_t width, size_t height);
116};
117
118// glFramebufferTexture3D
RAII wrapper for an OpenGL depth renderbuffer (GL_RENDERBUFFER).
RAII wrapper for a 2D OpenGL depth texture with compare mode enabled.
Cross‑platform OpenGL window/context helper for desktop and Emscripten.
RAII wrapper for an OpenGL 2D texture with byte/half/float upload helpers.
RAII wrapper for an OpenGL 3D texture with byte/float upload helpers.
Definition GLDepthBuffer.h:17
Definition GLDepthTexture.h:19
void unbind2D()
Detach 2D color attachments and unbind the FBO.
Definition GLFramebuffer.cpp:190
~GLFramebuffer()
Destroy the framebuffer (glDeleteFramebuffers).
Definition GLFramebuffer.cpp:10
GLFramebuffer()
Create a new framebuffer object (glGenFramebuffers).
Definition GLFramebuffer.cpp:4
const GLuint getId() const
Retrieve the OpenGL framebuffer object name.
Definition GLFramebuffer.cpp:215
bool checkBinding() const
Check whether the currently bound FBO is complete.
Definition GLFramebuffer.cpp:211
void bind(const GLDepthTexture &d)
Bind only a depth texture (no color attachments; draw buffer = NONE).
Definition GLFramebuffer.cpp:49
void unbind3D()
Detach 3D color/depth attachments and unbind the FBO.
Definition GLFramebuffer.cpp:200
Definition GLTexture2D.h:19
Definition GLTexture3D.h:18