From: Laszlo Agocs Date: Fri, 22 Aug 2014 17:31:13 +0000 (+0200) Subject: Fix up vao usage in qquickviewcomparison example X-Git-Tag: v5.3.99+beta1~117 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=04f0d937fe8056bb74fe9b6944c6f5b5b6f023f6;p=platform%2Fupstream%2Fqtdeclarative.git Fix up vao usage in qquickviewcomparison example The binder calls create() if needed, so drop that call. In the render function however, drop the binder. Trying to create() again and again on every frame is a waste of time. Change-Id: I1e9cd8e2c97030b96e604256661e65ce75446e9d Reviewed-by: Jørgen Lind --- diff --git a/examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp b/examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp index 3b9f2e9..d418a6b 100644 --- a/examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp +++ b/examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp @@ -162,8 +162,9 @@ void FbItemRenderer::render() { ensureInit(); - QOpenGLVertexArrayObject::Binder vaoBinder(&m_vao); - if (!m_vao.isCreated()) + if (m_vao.isCreated()) + m_vao.bind(); + else setupVertexAttribs(); StateBinder state(this); @@ -182,6 +183,9 @@ void FbItemRenderer::render() updateDirtyUniforms(); f->glDrawArrays(GL_TRIANGLES, 0, m_logo.vertexCount()); + + if (m_vao.isCreated()) + m_vao.release(); } QOpenGLFramebufferObject *FbItemRenderer::createFramebufferObject(const QSize &size) @@ -209,7 +213,6 @@ void FbItemRenderer::ensureInit() void FbItemRenderer::initBuf() { - m_vao.create(); QOpenGLVertexArrayObject::Binder vaoBinder(&m_vao); m_logoVbo.create();