avoid some opengl redundant calls
This commit is contained in:
parent
70f14b5ac3
commit
ee664657fb
|
@ -76,6 +76,9 @@ void Graphics::init()
|
||||||
g_painterOGL2 = new PainterOGL2;
|
g_painterOGL2 = new PainterOGL2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// blending is always enabled
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
// determine max texture size
|
// determine max texture size
|
||||||
static GLint maxTextureSize = -1;
|
static GLint maxTextureSize = -1;
|
||||||
if(maxTextureSize == -1)
|
if(maxTextureSize == -1)
|
||||||
|
@ -213,7 +216,6 @@ void Graphics::beginRender()
|
||||||
|
|
||||||
void Graphics::endRender()
|
void Graphics::endRender()
|
||||||
{
|
{
|
||||||
glFlush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::setViewportSize(const Size& size)
|
void Graphics::setViewportSize(const Size& size)
|
||||||
|
|
|
@ -105,13 +105,14 @@ void Painter::setTexture(Texture* texture)
|
||||||
m_texture = texture;
|
m_texture = texture;
|
||||||
|
|
||||||
if(texture) {
|
if(texture) {
|
||||||
m_glTextureId = texture->getId();
|
|
||||||
setTextureMatrix(texture->getTransformMatrix());
|
setTextureMatrix(texture->getTransformMatrix());
|
||||||
} else
|
|
||||||
m_glTextureId = 0;
|
|
||||||
m_texture = texture;
|
|
||||||
|
|
||||||
|
GLuint glTextureId = texture->getId();
|
||||||
|
if(glTextureId != m_glTextureId) {
|
||||||
|
m_glTextureId = glTextureId;
|
||||||
updateGlTexture();
|
updateGlTexture();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Painter::updateGlTexture()
|
void Painter::updateGlTexture()
|
||||||
|
|
Loading…
Reference in New Issue