code cleanup

This commit is contained in:
rachytski 2012-01-26 13:14:16 +04:00 committed by Alex Zolotarev
parent ffc9ceec7d
commit 482df7a7c7

View file

@ -24,7 +24,6 @@ namespace yg
RenderBuffer::RenderBuffer(size_t width, size_t height, bool isDepthBuffer)
: m_id(0), m_isDepthBuffer(isDepthBuffer), m_width(width), m_height(height)
{
// if (!m_isDepthBuffer)
{
OGLCHECK(glGenRenderbuffersFn(1, &m_id));
@ -38,33 +37,12 @@ namespace yg
m_width,
m_height));
}
/* else
{
OGLCHECK(glGenTextures(1, &m_id));
OGLCHECK(glBindTexture(GL_TEXTURE_2D, m_id));
OGLCHECK(glTexImage2D(GL_TEXTURE_2D,
0,
GL_DEPTH_COMPONENT24_MWM,
m_width,
m_height,
0,
GL_DEPTH_COMPONENT24_MWM,
GL_UNSIGNED_INT_24_8_MWM,
0));
}*/
}
RenderBuffer::~RenderBuffer()
{
if (g_hasContext)
{
// if(m_isDepthBuffer)
// OGLCHECK(glDeleteTextures(1, &m_id));
// else
OGLCHECK(glDeleteRenderbuffersFn(1, &m_id));
}
OGLCHECK(glDeleteRenderbuffersFn(1, &m_id));
}
unsigned int RenderBuffer::id() const
@ -74,20 +52,11 @@ namespace yg
void RenderBuffer::attachToFrameBuffer()
{
/* if (m_isDepthBuffer)
OGLCHECK(glFramebufferTexture2DFn(
GL_FRAMEBUFFER_MWM,
GL_DEPTH_ATTACHMENT_MWM,
GL_TEXTURE_2D,
id(),
0
));
else*/
OGLCHECK(glFramebufferRenderbufferFn(
GL_FRAMEBUFFER_MWM,
isDepthBuffer() ? GL_DEPTH_ATTACHMENT_MWM : GL_COLOR_ATTACHMENT0_MWM,
GL_RENDERBUFFER_MWM,
id()));
OGLCHECK(glFramebufferRenderbufferFn(
GL_FRAMEBUFFER_MWM,
isDepthBuffer() ? GL_DEPTH_ATTACHMENT_MWM : GL_COLOR_ATTACHMENT0_MWM,
GL_RENDERBUFFER_MWM,
id()));
if (!isDepthBuffer())
utils::setupCoordinates(width(), height(), false);