From b56343133d21622a6187bb1ef8906023ecbc09ef Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 11 Apr 2022 16:39:48 +0200 Subject: fixed blur rendering, stencil and gles3 --- src/render/Framebuffer.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/render/Framebuffer.cpp') 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); -- cgit v1.2.3