summaryrefslogtreecommitdiff
path: root/src/render/Framebuffer.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-04-11 16:39:48 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-04-11 16:39:48 +0200
commitb56343133d21622a6187bb1ef8906023ecbc09ef (patch)
treed755b40d36cf18b9ec1d6e49b5185cbad2d6fd79 /src/render/Framebuffer.cpp
parent0f9850fafcb2006e4bf943a65d79b99567a3be4f (diff)
fixed blur rendering, stencil and gles3
Diffstat (limited to 'src/render/Framebuffer.cpp')
-rw-r--r--src/render/Framebuffer.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/render/Framebuffer.cpp b/src/render/Framebuffer.cpp
index 85e1f7ca..3724da37 100644
--- a/src/render/Framebuffer.cpp
+++ b/src/render/Framebuffer.cpp
@@ -29,6 +29,17 @@ bool CFramebuffer::alloc(int w, int h) {
glBindTexture(GL_TEXTURE_2D, m_cTex.m_iTexID);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_cTex.m_iTexID, 0);
+
+ if (m_pStencilTex) {
+ glBindTexture(GL_TEXTURE_2D, m_pStencilTex->m_iTexID);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, w, h, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0);
+
+ glBindFramebuffer(GL_FRAMEBUFFER, m_iFb);
+ glBindTexture(GL_TEXTURE_2D, m_pStencilTex->m_iTexID);
+
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_pStencilTex->m_iTexID, 0);
+ }
+
auto status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
RASSERT((status == GL_FRAMEBUFFER_COMPLETE), "Framebuffer incomplete, couldn't create! (FB status: %i)", status);