avoid some opengl redundant calls

This commit is contained in:
Eduardo Bart 2012-04-24 13:37:46 -03:00
parent 70f14b5ac3
commit ee664657fb
2 changed files with 9 additions and 6 deletions

View File

@ -76,6 +76,9 @@ void Graphics::init()
g_painterOGL2 = new PainterOGL2;
#endif
// blending is always enabled
glEnable(GL_BLEND);
// determine max texture size
static GLint maxTextureSize = -1;
if(maxTextureSize == -1)
@ -213,7 +216,6 @@ void Graphics::beginRender()
void Graphics::endRender()
{
glFlush();
}
void Graphics::setViewportSize(const Size& size)

View File

@ -105,13 +105,14 @@ void Painter::setTexture(Texture* texture)
m_texture = texture;
if(texture) {
m_glTextureId = texture->getId();
setTextureMatrix(texture->getTransformMatrix());
} else
m_glTextureId = 0;
m_texture = texture;
updateGlTexture();
GLuint glTextureId = texture->getId();
if(glTextureId != m_glTextureId) {
m_glTextureId = glTextureId;
updateGlTexture();
}
}
}
void Painter::updateGlTexture()