Use shared VBO for paintBackground

This commit is contained in:
Martin Gräßlin 2010-12-11 16:02:40 +01:00
parent 6cb3b95cc1
commit a7dd31ef00

View file

@ -275,12 +275,13 @@ void SceneOpenGL::paintBackground(QRegion region)
verts << r.x() + r.width() << r.y() + r.height(); verts << r.x() + r.width() << r.y() + r.height();
verts << r.x() + r.width() << r.y(); verts << r.x() + r.width() << r.y();
} }
GLVertexBuffer vbo(GLVertexBuffer::Static); GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
vbo.setUseColor(true); vbo->reset();
vbo.setUseShader(true); vbo->setUseColor(true);
vbo.setData(verts.count() / 2, 2, verts.data(), NULL); vbo->setUseShader(true);
vbo->setData(verts.count() / 2, 2, verts.data(), NULL);
ShaderManager::instance()->pushShader(ShaderManager::ColorShader); ShaderManager::instance()->pushShader(ShaderManager::ColorShader);
vbo.render(GL_TRIANGLES); vbo->render(GL_TRIANGLES);
ShaderManager::instance()->popShader(); ShaderManager::instance()->popShader();
} }