我开始在QT中使用OpenCascade编写代码,发现下面这个有趣的基本项目:https://github.com/eryar/occQt/
我编制程序时:
QT +=核gui opengl
当我执行它时,我会得到以下错误:
VBO类型: TKOpenGl创建基本数组失败169个顶点。没记忆了?
我也在项目现场张贴了这个问题,但我不确定在那个地方的活动。这就是为什么我要问你是否有任何解决办法的想法。
我的实验床:
发布于 2018-10-22 17:32:03
我没有试图编译这个程序,但是快速地看了一下,可能是GPU驱动程序问题,由于某种原因,glGenBuffer没有生成缓冲区对象--这就是我如何推断>>在fort6.9.1中,文件OpenGl_PrimitiveArray.cxx,函数:
Standard_Boolean OpenGl_PrimitiveArray::initNormalVbo (const Handle(OpenGl_Context)& theCtx) const
有:
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;
}
这意味着,在文件OpenGl_VertexBuffer.cxx中,函数:
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;
}
还假的,
因为
bool OpenGl_VertexBuffer::Create (const Handle(OpenGl_Context)& theGlCtx)
{
if (myBufferId == NO_BUFFER)
{
theGlCtx->core15fwd->glGenBuffers (1, &myBufferId);
}
return myBufferId != NO_BUFFER;
}
返回false,这意味着myBufferId仍然等于OpenGl_VertexBuffer构造函数中设置的NO_BUFFER,这意味着
theGlCtx->core15fwd->glGenBuffers (1, &myBufferId);
并没有改变任何事情。OpenGl_Context.hxx行中的评论:583说
OpenGl_GlCore15Fwd* core15fwd; //!< OpenGL 1.5 without deprecated entry points
OpenGl_GlCore15Fwd::glGenBuffers函数只是调用文件OpenGl_GlFunctions.hxx中的OpenGL函数
inline void glGenBuffers (GLsizei n, GLuint *buffers)
{
::glGenBuffers (n, buffers);
}
这可能是错误的推论,但我没有深入挖掘
https://stackoverflow.com/questions/52852269
复制相似问题