Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Q: Qt - [c++] Unknown OpenGL error
Forum Updated to NodeBB v4.3 + New Features

Q: Qt - [c++] Unknown OpenGL error

Scheduled Pinned Locked Moved Unsolved Game Development
3 Posts 2 Posters 815 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kevin_d
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kevin_d
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • R Offline
        R Offline
        robert2001b
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved