diff options
Diffstat (limited to 'src/gui/opengl/qopenglvertexarrayobject.cpp')
-rw-r--r-- | src/gui/opengl/qopenglvertexarrayobject.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp index d3eadf9ae12..42bb1a3a52d 100644 --- a/src/gui/opengl/qopenglvertexarrayobject.cpp +++ b/src/gui/opengl/qopenglvertexarrayobject.cpp @@ -144,6 +144,11 @@ bool QOpenGLVertexArrayObjectPrivate::create() qWarning("QOpenGLVertexArrayObject::create() requires a valid current OpenGL context"); return false; } + + //Fail early, if context is the same as ctx, it means we have tried to initialize for this context and failed + if (ctx == context) + return false; + context = ctx; QObject::connect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed())); @@ -161,12 +166,10 @@ bool QOpenGLVertexArrayObjectPrivate::create() if (format.version() >= qMakePair<int, int>(3,2)) { vaoFuncs.core_3_2 = ctx->versionFunctions<QOpenGLFunctions_3_2_Core>(); vaoFuncsType = Core_3_2; - vaoFuncs.core_3_2->initializeOpenGLFunctions(); vaoFuncs.core_3_2->glGenVertexArrays(1, &vao); } else if (format.majorVersion() >= 3) { vaoFuncs.core_3_0 = ctx->versionFunctions<QOpenGLFunctions_3_0>(); vaoFuncsType = Core_3_0; - vaoFuncs.core_3_0->initializeOpenGLFunctions(); vaoFuncs.core_3_0->glGenVertexArrays(1, &vao); } else #endif |