Performance improvement: copy texture bits to video card only if they have changed

This commit is contained in:
Tats
2014-04-26 13:32:27 +01:00
parent ce305140a8
commit ca9ba38682
6 changed files with 43 additions and 18 deletions
+5 -2
View File
@@ -112,8 +112,11 @@ void SourceGLCanvas::_drawTexture(QPainter* painter, Paint::ptr paint, QMap<uid,
glEnable (GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture->getTextureId());
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->getWidth(), texture->getHeight(), 0, GL_RGBA,
GL_UNSIGNED_BYTE, texture->getBits());
if (texture->bitsHaveChanged())
{
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->getWidth(), texture->getHeight(), 0, GL_RGBA,
GL_UNSIGNED_BYTE, texture->getBits());
}
//std::cout << texture->getX() << "x" << texture->getY() << " : " << texture->getWidth() << "x" << texture->getHeight() << " " << texture->getTextureId() << std::endl;