I believe I am releasing the binding resources after every render call explicitly:
void TriangleScene::render()
{
..................................
.................................
//draw the triangle
glDrawElements(GL_TRIANGLES,3,GL_UNSIGNED_SHORT,0);
glDisableVertexAttribArray(mTriangleShader->getAttribute("vVertex"));
glDisableVertexAttribArray(mTriangleShader->getAttribute("vColor"));
glBindVertexArray(0);
mTriangleShader->UnUse();
}
void TriangleScene::render()
{
..................................
.................................
//draw the triangle
glDrawElements(GL_TRIANGLES,3,GL_UNSIGNED_SHORT,0);
glDisableVertexAttribArray(mTriangleShader->getAttribute("vVertex"));
glDisableVertexAttribArray(mTriangleShader->getAttribute("vColor"));
glBindVertexArray(0);
mTriangleShader->UnUse();
}
To copy to clipboard, switch view to plain text mode
Anyway , i tried as you suggested and it did not change the behavior. I hope that you skimmed through the source that I provided you with. I called the function in the following manner:
void TriangleSceneItem::handleWidowChanged(QQuickWindow *win)
{
if(win)
{
QSurfaceFormat f = win->format();
f.setMajorVersion(4);
f.setMinorVersion(3);
f.setSamples(4);
f.setStencilBufferSize(8);
f.setProfile(QSurfaceFormat::CompatibilityProfile);
win->setFormat(f);
win->setClearBeforeRendering(false);
connect(win,SIGNAL(beforeSynchronizing()),this,SLOT(sync()),Qt::DirectConnection);
connect(win,SIGNAL(sceneGraphInvalidated()),this,SLOT(cleanup()),Qt::DirectConnection);
connect(win,SIGNAL(beforeRendering()),mScene,SLOT(paint()),Qt::DirectConnection);
win->resetOpenGLState();
}
}
void TriangleSceneItem::handleWidowChanged(QQuickWindow *win)
{
if(win)
{
QSurfaceFormat f = win->format();
f.setMajorVersion(4);
f.setMinorVersion(3);
f.setSamples(4);
f.setStencilBufferSize(8);
f.setProfile(QSurfaceFormat::CompatibilityProfile);
win->setFormat(f);
win->setClearBeforeRendering(false);
connect(win,SIGNAL(beforeSynchronizing()),this,SLOT(sync()),Qt::DirectConnection);
connect(win,SIGNAL(sceneGraphInvalidated()),this,SLOT(cleanup()),Qt::DirectConnection);
connect(win,SIGNAL(beforeRendering()),mScene,SLOT(paint()),Qt::DirectConnection);
win->resetOpenGLState();
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks