我没有尝试编译程序,但快速查看后可能是GPU 驱动程序问题,由于某种原因 glGenBuffer 没有生成缓冲区对象,这就是我在 occt6.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 line: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);
}
这可能是错误的推论,但我没有深入挖掘