8 #ifndef hifi_gpu_gl_GLFramebuffer_h
9 #define hifi_gpu_gl_GLFramebuffer_h
12 #include "GLBackend.h"
14 namespace gpu {
namespace gl {
16 class GLFramebuffer :
public GLObject<Framebuffer> {
18 template <
typename GLFramebufferType>
19 static GLFramebufferType* sync(GLBackend& backend,
const Framebuffer& framebuffer) {
20 GLFramebufferType*
object = Backend::getGPUObject<GLFramebufferType>(framebuffer);
22 bool needsUpate {
false };
24 framebuffer.getDepthStamp() != object->_depthStamp ||
25 framebuffer.getColorStamps() != object->_colorStamps) {
32 }
else if (framebuffer.isEmpty()) {
40 object =
new GLFramebufferType(backend.shared_from_this(), framebuffer);
41 Backend::setGPUObject(framebuffer,
object);
42 (void)CHECK_GL_ERROR();
49 template <
typename GLFramebufferType>
50 static GLuint getId(GLBackend& backend,
const Framebuffer& framebuffer) {
51 GLFramebufferType* fbo = sync<GLFramebufferType>(backend, framebuffer);
59 const GLuint& _fbo { _id };
60 std::vector<GLenum> _colorBuffers;
61 Stamp _depthStamp { 0 };
62 std::vector<Stamp> _colorStamps;
65 GLenum _status { GL_FRAMEBUFFER_COMPLETE };
66 virtual void update() = 0;
67 bool checkStatus()
const;
69 GLFramebuffer(
const std::weak_ptr<GLBackend>& backend,
const Framebuffer& framebuffer, GLuint
id) : GLObject(backend, framebuffer, id) {}