Q: Qt - [c++] Unknown OpenGL error
-
Hello Qt Forum!
I am frequently creating and deleting, as well as attaching, removing entities and components on a Qt3D Window (scene).
After creating the game scene a fourth or fifth time (having destroyed a lot of Qt3DCore::QEntities and then rebuilding the 3D scene), but rather randomly, suddenly, I get massive errors like this (from this point the program is vulnerable and may crash):
ARB::createContext: wglCreateContextAttribsARB() failed (GL error code: 0x0) for format: QSurfaceFormat(version 4.3, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples 4, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile QSurfaceFormat::CoreProfile), shared context: 0x0 (Der Vorgang wurde erfolgreich beendet.) GDI::createContext: wglCreateContext failed. (Unknown error 0xc00705aa.) Unable to create a GL Context.
Do you maybe know, where this is coming from?
best regards, kevin
-
Basically, this is the code, at which the error occurrs:
(But it is strange, because this happens indeterministic, or at least quite random after some time... the scene got recreated several times, without an error)
I am confident, that i destroyed oll my entities and components, before the scene gets recreated again.... auto* transparentTileMesh = new Qt3DExtras::QCuboidMesh; transparentTileMesh->setXExtent(1); transparentTileMesh->setYExtent(1); transparentTileMesh->setZExtent(0.001f); auto *transparentEntity = new Qt3DCore::QEntity(_root); transparentEntity->addComponent(transparentTileMesh); Qt3DCore::QTransform *transparentScaleTransform = new Qt3DCore::QTransform; transparentScaleTransform->setScale3D(QVector3D(1,1,1)); transparentScaleTransform->setTranslation(QVector3D(xPos, yPos, zPos + 0.125)); transparentEntity->addComponent(transparentScaleTransform); Qt3DRender::QMaterial* material = new Qt3DExtras::QPhongAlphaMaterial; material->setAmbient(color); material->setDiffuse(color); material->setShininess(shininess); material->setSpecular(specular); material->setAlpha(alpha); material->setSourceAlphaArg(Qt3DRender::QBlendEquationArguments::DestinationColor); ... // this is the function that may cast an error void GeometryObject::setTransparentTexture(Qt3DRender::QMaterial* texture) { if (material!= nullptr) transparentEntity->removeComponent(material); material = texture; transparentEntity->addComponent(material); }
cheers, kevin
-
This post is deleted!