Skip to content

Commit

Permalink
gl_rendertarget: Always set all draw buffers.
Browse files Browse the repository at this point in the history
  • Loading branch information
CrossVR committed Mar 24, 2016
1 parent a854ef6 commit 2407c94
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/Layers/xrRenderPC_GL/gl_rendertarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,80 +19,77 @@ void CRenderTarget::u_setrt(const ref_rt& _1, const ref_rt& _2, const ref_rt& _3
VERIFY(_1);
dwWidth = _1->dwWidth;
dwHeight = _1->dwHeight;
GLuint cnt = 0;
GLenum buffers[3] = { GL_NONE };
if (_1)
{
buffers[cnt++] = GL_COLOR_ATTACHMENT0;
buffers[0] = GL_COLOR_ATTACHMENT0;
RCache.set_RT(_1->pRT, 0);
}
if (_2)
{
buffers[cnt++] = GL_COLOR_ATTACHMENT1;
buffers[1] = GL_COLOR_ATTACHMENT1;
RCache.set_RT(_2->pRT, 1);
}
if (_3)
{
buffers[cnt++] = GL_COLOR_ATTACHMENT2;
buffers[2] = GL_COLOR_ATTACHMENT2;
RCache.set_RT(_3->pRT, 2);
}
RCache.set_ZB(zb);
// RImplementation.rmNormal ();
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
VERIFY(status == GL_FRAMEBUFFER_COMPLETE);
CHK_GL(glDrawBuffers(cnt, buffers));
CHK_GL(glDrawBuffers(3, buffers));
}

void CRenderTarget::u_setrt(const ref_rt& _1, const ref_rt& _2, GLuint zb)
{
VERIFY(_1);
dwWidth = _1->dwWidth;
dwHeight = _1->dwHeight;
GLuint cnt = 0;
GLenum buffers[2] = { GL_NONE };
if (_1)
{
buffers[cnt++] = GL_COLOR_ATTACHMENT0;
buffers[0] = GL_COLOR_ATTACHMENT0;
RCache.set_RT(_1->pRT, 0);
}
if (_2)
{
buffers[cnt++] = GL_COLOR_ATTACHMENT1;
buffers[1] = GL_COLOR_ATTACHMENT1;
RCache.set_RT(_2->pRT, 1);
}
RCache.set_ZB(zb);
// RImplementation.rmNormal ();
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
VERIFY(status == GL_FRAMEBUFFER_COMPLETE);
CHK_GL(glDrawBuffers(cnt, buffers));
CHK_GL(glDrawBuffers(2, buffers));
}

void CRenderTarget::u_setrt(u32 W, u32 H, GLuint _1, GLuint _2, GLuint _3, GLuint zb)
{
dwWidth = W;
dwHeight = H;
GLuint cnt = 0;
GLenum buffers[3] = { GL_NONE };
if (_1)
{
buffers[cnt++] = GL_COLOR_ATTACHMENT0;
buffers[0] = GL_COLOR_ATTACHMENT0;
RCache.set_RT(_1, 0);
}
if (_2)
{
buffers[cnt++] = GL_COLOR_ATTACHMENT1;
buffers[1] = GL_COLOR_ATTACHMENT1;
RCache.set_RT(_2, 1);
}
if (_3)
{
buffers[cnt++] = GL_COLOR_ATTACHMENT2;
buffers[2] = GL_COLOR_ATTACHMENT2;
RCache.set_RT(_3, 2);
}
RCache.set_ZB(zb);
// RImplementation.rmNormal ();
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
VERIFY(status == GL_FRAMEBUFFER_COMPLETE);
CHK_GL(glDrawBuffers(cnt, buffers));
CHK_GL(glDrawBuffers(3, buffers));
}

void CRenderTarget::u_stencil_optimize (eStencilOptimizeMode eSOM)
Expand Down

0 comments on commit 2407c94

Please sign in to comment.