Question

I am using the Ogre3d engine supporting OpenGL mode.

I have an object called Chunk which creates an Ogre::ManualObject. Because the creation of the ManualObject takes a bit of time I put the task onto a new thread.

Unfortunately, after threading the creation of the ManualObject I am now getting the following OgreException:

"Cannot create GL vertex buffer in GLHardwareVertexBuffer::GLHardwareVertexBuffer"

I looked into the code and it is failing at this stage:

glGenBuffersARB( 1, &mBufferId );

if (!mBufferId)
{
    OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR,
        "Cannot create GL vertex buffer",
        "GLHardwareVertexBuffer::
}

This suggests that glGenBuffersARB() is not properly populating mBufferId.

I can't figure out what is causing this, any suggestions?

Was it helpful?

Solution

Because the creation of the ManualObject takes a bit of time I put the task onto a new thread.

That's your problem right there. An OpenGL context can be active in only one thread at a time. If you call OpenGL commands from a thread which doesn't have an OpenGL context bound, all you get are errors.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top