Updated texture memory management code to eliminate inter-frame texture swapping and glFinish() calls, favouring performance over maximum texture resolution when memory is insufficient for textures at full resolution.

--HG--
extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%40159
This commit is contained in:
kearwood
2012-11-17 00:15:52 +00:00
parent c30c9725e9
commit a0549b4cfb
23 changed files with 406 additions and 180 deletions

View File

@@ -190,7 +190,7 @@ void KRLight::render(KRCamera *pCamera, std::vector<KRLight *> &lights, const KR
pShader->m_uniforms[KRShader::KRENGINE_UNIFORM_FLARE_SIZE],
m_flareSize
));
m_pContext->getTextureManager()->selectTexture(0, m_pFlareTexture, 2048);
m_pContext->getTextureManager()->selectTexture(0, m_pFlareTexture);
m_pContext->getModelManager()->bindVBO((void *)KRENGINE_VBO_2D_SQUARE, KRENGINE_VBO_2D_SQUARE_SIZE, true, false, false, true, false);
GLDEBUG(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4));
}
@@ -270,6 +270,12 @@ void KRLight::renderShadowBuffers(KRCamera *pCamera)
glViewport(0, 0, m_shadowViewports[iShadow].getSize().x, m_shadowViewports[iShadow].getSize().y);
GLDEBUG(glBindFramebuffer(GL_FRAMEBUFFER, shadowFramebuffer[iShadow]));
GLDEBUG(glClearDepthf(0.0f));
GLDEBUG(glClear(GL_DEPTH_BUFFER_BIT));
glViewport(0, 0, m_shadowViewports[iShadow].getSize().x, m_shadowViewports[iShadow].getSize().y);
GLDEBUG(glClearDepthf(1.0f));
GLDEBUG(glClear(GL_DEPTH_BUFFER_BIT));