简体   繁体   中英

QT and OpenCascade out of memory

I am starting to code with OpenCascade in QT, finding this interesting basic project: https://github.com/eryar/occQt/

I have compiled the program with:

QT += core gui opengl

and when I execute it, I get the following error:

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message: VBO creation for Primitive Array has failed for 169 vertices. Out of memory?

I have also posted the issue in the project site, but I am not sure about the activity in that place. That is why I am asking you if you had any idea to workaround.

My testbed:

  • Intel i7 with 8GB of memory
  • Windows 10
  • OpenCascade 6.9.1 vc12-64
  • QT 5.5.1

i didn't try to compile the program but after a quick look it may be a GPU driver problem ,for some reason glGenBuffer didn't genetate the buffer object this is how i deduced that >> in occt6.9.1 , file OpenGl_PrimitiveArray.cxx ,the function :

Standard_Boolean OpenGl_PrimitiveArray::initNormalVbo (const Handle(OpenGl_Context)& theCtx) const 

there is :

  if (!myVboAttribs->init (theCtx, 0, myAttribs->NbElements, myAttribs->Data(), GL_NONE, myAttribs->Stride))
  {
    TCollection_ExtendedString aMsg;
    aMsg += "VBO creation for Primitive Array has failed for ";
    aMsg += myAttribs->NbElements;
    aMsg += " vertices. Out of memory?";
    theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB, GL_DEBUG_TYPE_PERFORMANCE_ARB, 0, GL_DEBUG_SEVERITY_LOW_ARB, aMsg);

    clearMemoryGL (theCtx);
    return Standard_False;
  }

which means that , in file OpenGl_VertexBuffer.cxx the function :

bool OpenGl_VertexBuffer::init (const Handle(OpenGl_Context)& theGlCtx,
                                const GLuint   theComponentsNb,
                                const GLsizei  theElemsNb,
                                const void*    theData,
                                const GLenum   theDataType,
                                const GLsizei  theStride)
{
  if (!Create (theGlCtx))
  {
    return false;
  }

  Bind (theGlCtx);
  myDataType     = theDataType;
  myComponentsNb = theComponentsNb;
  myElemsNb      = theElemsNb;
  theGlCtx->core15fwd->glBufferData (GetTarget(), GLsizeiptr(myElemsNb) * theStride, theData, GL_STATIC_DRAW);
  bool isDone = (glGetError() == GL_NO_ERROR); // GL_OUT_OF_MEMORY
  Unbind (theGlCtx);
  return isDone;
}

returned false,

because

bool OpenGl_VertexBuffer::Create (const Handle(OpenGl_Context)& theGlCtx)
{
  if (myBufferId == NO_BUFFER)
  {
    theGlCtx->core15fwd->glGenBuffers (1, &myBufferId);
  }
  return myBufferId != NO_BUFFER;
}

returned false , which means that myBufferId is still equal to NO_BUFFER as set in the constructor of OpenGl_VertexBuffer which means that

theGlCtx->core15fwd->glGenBuffers (1, &myBufferId);

didn't change any thing . the comment in OpenGl_Context.hxx line:583 says

  OpenGl_GlCore15Fwd*  core15fwd;  //!< OpenGL 1.5 without deprecated entry points

the OpenGl_GlCore15Fwd::glGenBuffers function is just calling the OpenGL function as in file OpenGl_GlFunctions.hxx

  inline void glGenBuffers (GLsizei n, GLuint *buffers)
  {
    ::glGenBuffers (n, buffers);
  }

it may be wrong deduction but I didn't dig deeper

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM