38 if (_size ==
size())
return;
43 int _h = _size.height();
44 int _w = _size.width();
47 _.glBindTexture(GL_TEXTURE_2D,
colorTex_);
48 _.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
49 _.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
50 _.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
51 _.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
54 _.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F , _w, _h, 0, GL_RGBA,
58 _.glGenFramebuffers(1, &
fb_);
62 _.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
68 _.glBindRenderbuffer(GL_RENDERBUFFER,
depthRb_);
69 _.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, _w,
74 _.glFramebufferRenderbuffer(GL_FRAMEBUFFER,
81 status = _.glCheckFramebufferStatus(GL_FRAMEBUFFER);
83 if (status != GL_FRAMEBUFFER_COMPLETE) {
88 _.glBindTexture(GL_TEXTURE_2D,0);
89 _.glBindRenderbuffer(GL_RENDERBUFFER,0);
void release()
Definition: Framebuffer32F.cpp:109
void destroy()
Free buffer from current context.
Definition: Framebuffer32F.cpp:94
void withCurrentContext(ContextFunctor f)
Do OpenGL operations with current context, if it exists.
Definition: ContextSwitch.cpp:45
QSize size_
Definition: Framebuffer32F.h:55
GLuint colorTex_
Definition: Framebuffer32F.h:57
GLuint fb_
Definition: Framebuffer32F.h:56
QSize const & size() const
Return size of framebuffer.
Definition: Framebuffer32F.cpp:128
GLuint depthRb_
Definition: Framebuffer32F.h:58
void bind()
Definition: Framebuffer32F.cpp:103